Cerca

Heus ací els resultats de la cerca.

2.6 Abstract classes
197 Resultats, Darrera modificació:
= 2.6 Abstract classes Python is considered to be a very flexible programming language, but that doesn’t mean that there are no controls 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 some means of establishing requirement
2.1 Python core syntax
174 Resultats, Darrera modificació:
ormulate expressions using algebraic symbols representing operators, or to get a number of elements in a sequence or dictionary. We are able to add two or m... rator, but on respective data types. Now, we'll use the same function ''len()'' to get a number of el... operators when applied to our objects, so we can use core operators on our objects. Let's imagine the
5.1 Metaprogramming
143 Resultats, Darrera modificació:
= 5.1 Metaprogramming == Introduction to metaclasses Metaprogramming is a programming technique in whi... protocol. It may look like syntactic sugar, because in many cases metaprogramming allows programmers to minimize the number of lines of code to express a... . But the truth is that this technique could be used for tool preparation; those tools could be appli
2.8 Composition vs Inheritance - two ways to the same destination
123 Resultats, Darrera modificació:
ing the inheritance concept when modeling our classes to represent real-life issues. Inheritance is a great concept, one of the most important foundations... ming that models a tight relation between two classes: the base class and the derived class, called a subclass. The result of this relation is a subclass
1.1 Classes, Instances, Attributes, Methods — introduction
121 Resultats, Darrera modificació:
= 1.1 Classes, Instances, Attributes, Methods — introduction == Introduction to Object-Oriented Programming This module addresses the advanced Object Oriented Programming (OOP) i... programming. This very important approach is present in most computer applications because it allows programmers to model entities representing real-lif
2.9 Inheriting properties from built-in classes
113 Resultats, Darrera modificació:
= 2.9 Inheriting properties from built-in classes Python gives you the ability to create a class that ... arent or even parents and you can still access those attributes and methods. Later, you can override ... hods by delivering your own modifications for the selected methods. In the following example, we’ll c... an object? Imagine that you need to collect the serial numbers of sold tickets. Sound reasonable eno
2.7 Encapsulation
112 Resultats, Darrera modificació:
f bundling attributes and methods that work on those attributes within a class. Encapsulation is used to hide the **attributes** inside a class like in a... to access** the values, and other objects call those methods to retrieve and modify the values within ... t of privacy for the attributes. This picture presents the idea: direct access to the object attribut
2.2 Inheritance and polymorphism — Inheritance as a pillar of OOP
110 Resultats, Darrera modificació:
oncepts of object oriented programming, and expresses the fundamental relationships between classes: superclasses (parents) and their subclasses (descendants). Inheritance creates a class hierarchy. Any object boun
2.4 Decorators
102 Resultats, Darrera modificació:
n is able to decorate functions, methods, and classes. The decorator's operation is based on wrapping the original function with a new "decorating" funct... that the **decorating** function can call the passed function. The decorating function returns a function that can be called later. Of course, the **decorating** function does more, because i
3.1 Advanced techniques of creating and serving exceptions
85 Resultats, Darrera modificació:
= 3.1 Advanced techniques of creating and serving exceptions In this module, we'll talk about Python exceptions – objects that represent errors which occur during the execution of a pr... ial kind of data, called an **exception**. Of course, this exception is an object. Both of these activities are called **raising an exception**. We can s
2.5 Different faces of Python methods
82 Resultats, Darrera modificació:
tance methods, as the first parameter, take the ''self'' parameter, which is their hallmark. It’s worth emphasizing and remembering that ''self'' allows you to refer to the instance. Of course, it follows that in order to successfully use the instance method, the instance must have previously
4.1 Shallow and deep copy operations
79 Resultats, Darrera modificació:
forms any kind of data processing without making use of variables. As variables are fundamental elemen... of copying them. When you spot the following clause: <code python> a_list = [ 1, 'New York', 100] </c... }} (Note that an assignment statement is being used, so evaluation of the right side of the clause takes precedence over the left side.) * At first,
1.2 Working with class and instance data – instance variables
74 Resultats, Darrera modificació:
removed at any time. Each object carries its own set of variables – they don't interfere with one ano... way. The word instance suggests that they are closely connected to the objects (which are class instances), not to the classes themselves. To get access to the instance variable, you should address the variable in the following
4.2 Serialization of Python objects using the pickle module
62 Resultats, Darrera modificació:
= 4.2 Serialization of Python objects using the pickle module In this section, you will learn how to persist Python objects for later use. **Pickling** is the process of preserving or extending the lifespan of food. The resulting food is
4.3 Making Python objects persistent using the shelve module
34 Resultats, Darrera modificació:
hon objects persistent using the shelve module == Serialization of Python objects using the shelve module As you remember, the pickle module is used for serializing objects as a single byte stream. Both serializing and deserializing parties must abide by th
2.3 Extended function argument syntax
32 Resultats, Darrera modificació: