Cerca
Heus ací els resultats de la cerca.
Resultats de text complet:
- 4.1 Shallow and deep copy operations
- lly, you'll learn about: * object: label vs. identity vs. value; * the id() function and the is o... t making use of variables. As variables are fundamental elements that allow us to cope with objects, let's talk in detail about variables and objects, and possible ways of copying them. When you spot the following clause: <code python> a_li
- 2.9 Inheriting properties from built-in classes
- ilt-in class in order to get a new class that can enrich the parent's attributes or methods. As a result, your newly-created class has the advantage of al... well-known functionalities inherited from its parent or even parents and you can still access those attributes and methods. Later, you can override the
- 2.8 Composition vs Inheritance - two ways to the same destination
- 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 important foundations of object-oriented programming that models a tight relation betwe
- 2.2 Inheritance and polymorphism — Inheritance as a pillar of OOP
- s a pillar of OOP Inheritance is one of the fundamental concepts of object oriented programming, and expresses the fundamental relationships between classes: superclasses (parents) and their subclasses (descendants). Inherita
- 2.4 Decorators
- ion with a new "decorating" function (or class), hence the name "decoration". This is done by passing ... rating function. The same principle is applied when we decorate classes. We'll talk about this a bit ... before and after a call to a wrapped object or even to prevent its execution, depending on the circumstances. As a result, we can change the operation of
- 5.1 Metaprogramming
- grams’ codes. It may sound like an idea from a science fiction story, but the idea was born and implemented in the early 1960s. For Python, code modifica... being executed, and you might have already experienced it while implementing decorators, overriding operators, or even implementing the properties protoc
- 2.6 Abstract classes
- nctionalities or an order in a class hierarchy. When you develop a system in a group of programmers, i... useful to have some means of establishing requirements for classes in matters of interfaces (methods) ... eprint for other classes, a kind of contract between a __class designer__ and a __programmer__: * the class designer sets requirements regarding methods that must be implemented by j
- 2.3 Extended function argument syntax
- = 2.3 Extended function argument syntax When we talk about function arguments, we should recall the following facts: * some functions can be in
- 3.1 Advanced techniques of creating and serving exceptions
- talk about Python exceptions – objects that represent errors which occur during the execution of a pro... exception. == Exceptions - short introduction When Python executes a script and encounters a situation that it cannot cope with, it: * stops your pro... s raises an exception (or that an exception has been raised) when it has no idea what do to with your
- 2.7 Encapsulation
- = 2.7 Encapsulation == Attribute encapsulation Encapsulation is one of the fundamental concepts in object-oriented programming (amongst inheritance, po
- 2.1 Python core syntax
- = 2.1 Python core syntax So far we have been using Python core operations that allow us to operate on ... rmulate 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 more strings together, which results in the
- 2.5 Different faces of Python methods
- = 2.5 Different faces of Python methods Until now, we’ve been implementing methods that have performed operations on the instances (objects), and in particular the... The code in the editor demonstrates the idea presented above. <code python> class Example: def _
- 1.2 Working with class and instance data – instance variables
- Instance variables This kind of variable exists when and only when it is explicitly created and added to an object. This can be done during the object's i... formed by the __init__ method, or later at any moment of the object's life. Furthermore, any existing ... variable is created and accessed in the code presented below. <code python> class Demo: def __in
- 1.1 Classes, Instances, Attributes, Methods — introduction
- thods — introduction == Introduction to Object-Oriented Programming This module addresses the advanced Object Oriented Programming (OOP) issues that are at the heart of Python programming. The object-oriented approach is an evolution of good design practi... programming. This very important approach is present in most computer applications because it allows
- 4.2 Serialization of Python objects using the pickle module
- **Pickling** is the process of preserving or extending the lifespan of food. The resulting food is called a pickle, and to prevent ambiguity, prefaced with the 'pickled' adjective... use? The simplest way to persist outcomes is to generate a flat text file and to write your outcomes.... hich is not suitable for persisting sets of different types of objects or nested structures. In Pytho