Cerca

Heus ací els resultats de la cerca.

5.1 Metaprogramming
123 Resultats, Darrera modificació:
= 5.1 Metaprogramming == Introduction to metaclasses Metaprogramming is a programming technique in which computer programs have the ability to modif... tion story, but the idea was born and implemented in the early 1960s. For Python, code modifications ... tocol. It may look like syntactic sugar, because in many cases metaprogramming allows programmers to
2.9 Inheriting properties from built-in classes
121 Resultats, Darrera modificació:
= 2.9 Inheriting properties from built-in classes Python gives you the ability to create a class that inherits properties from any Python built-in class in order to get a new class that can enrich the paren
2.2 Inheritance and polymorphism — Inheritance as a pillar of OOP
107 Resultats, Darrera modificació:
= 2.2 Inheritance and polymorphism — Inheritance as a pillar of OOP Inheritance is one of the fundamental concepts of object oriented program... ses (parents) and their subclasses (descendants). Inheritance creates a class hierarchy. Any object bo
2.1 Python core syntax
104 Resultats, Darrera modificació:
tions that allow us to operate on strings, lists, integers, and floats. It’s natural for us to formula... senting operators, or to get a number of elements in a sequence or dictionary. We are able to add two or more strings together, which results in the strings’ concatenation; we are able to add integers and we know what the result should be, all do
3.1 Advanced techniques of creating and serving exceptions
100 Resultats, Darrera modificació:
ced techniques of creating and serving exceptions In this module, we'll talk about Python exceptions –... am that disrupts the normal flow of the program's instructions. Plan for the module: * short introduction to exceptions; * review of the named attributes of exception objects; * introduction to chained exceptions; * analysis of
1.2 Working with class and instance data – instance variables
95 Resultats, Darrera modificació:
= 1.2 Working with class and instance data – instance variables == Instance variables This kind of variable exists when and only when it is explicitl... o an object. This can be done during the object's initialization, performed by the __init__ method, or
2.5 Different faces of Python methods
87 Resultats, Darrera modificació:
ing methods that have performed operations on the instances (objects), and in particular the attributes of the instance, so we’ve called them i**nstance methods**. The instance methods, as the first parameter, take the '
2.4 Decorators
86 Resultats, Darrera modificació:
thout directly modifying it. Decorators are used in: * the validation of arguments; * the modifi... st functions we could think of. We'll decorate it in a moment. <code python> def simple_hello(): ... > The last lines are responsible for both method invocations: <code python> decorated = simple_decora... he whole code should look like the code presented in the right pane. When you run the code, the resul
1.1 Classes, Instances, Attributes, Methods — introduction
76 Resultats, Darrera modificació:
= 1.1 Classes, Instances, Attributes, Methods — introduction == Introduction to Object-Oriented Programming This module addresses the advanced Object Or... ramming. This very important approach is present in most computer applications because it allows prog
2.8 Composition vs Inheritance - two ways to the same destination
71 Resultats, Darrera modificació:
= 2.8 Composition vs Inheritance - two ways to the same destination So far we've been using and following the inheritance concept when modeling our classes to represent real-life issues. Inheritance is a great concept, one of the most impo... result of this relation is a subclass class that inherits **all** methods and **all** properties of t
4.1 Shallow and deep copy operations
70 Resultats, Darrera modificació:
Copying objects using shallow and deep operations In this module, you’ll learn how to copy Python obje... ts that allow us to cope with objects, let's talk in detail about variables and objects, and possible ... thon> a_list = [ 1, 'New York', 100] </code> {{ :info:cursos:pue:python-pcpp1:pasted:20231026-143815.... the left side.) * At first, an object (a list in this example) is created in the computer's memory
2.6 Abstract classes
65 Resultats, Darrera modificació:
ls to impose a set of functionalities or an order in a class hierarchy. When you develop a system in a group of programmers, it would be useful to have so... me means of establishing requirements for classes in matters of interfaces (methods) exposed by each class. == What is an abstract class? An **abstract cl
4.2 Serialization of Python objects using the pickle module
46 Resultats, Darrera modificació:
ization of Python objects using the pickle module In this section, you will learn how to persist Pytho... different types of objects or nested structures. In Python, object **serialization** is the process of converting an object structure into a stream of bytes to store the object in a file or database, or to transmit it via a network. This
2.7 Encapsulation
36 Resultats, Darrera modificació:
Encapsulation is one of the fundamental concepts in object-oriented programming (amongst inheritance, polymorphism, and abstraction). It describes the id... Encapsulation is used to hide the **attributes** inside a class like in a **capsule**, preventing unauthorized parties' direct access to them. Publicly a
2.3 Extended function argument syntax
25 Resultats, Darrera modificació:
l the following facts: * some functions can be invoked without arguments; * functions may require... s; we have to pass a required number of arguments in an imposed order to follow function definition; ... as keyword parameters; * we can pass arguments in any order if we are assigning keywords to all arg... 20, 10) print('--', '++') </code> All presented invocations of the **print()** function end correctl
4.3 Making Python objects persistent using the shelve module
11 Resultats, Darrera modificació: