Cerca
Heus ací els resultats de la cerca.
Resultats de text complet:
- 2.4 Decorators
- = 2.4 Decorators A decorator is one of the design patterns that describes the structure of related objects. Python is able to decorate functions, methods, and classes. The decorator's operation is based on wrapping the original function with a new "decorating" function (or
- 3.1 Advanced techniques of creating and serving exceptions
- objects that represent errors which occur during the execution of a program that disrupts the normal flow of the program's instructions. Plan for the module: * short introduction to exceptions; * review of the
- 4.1 Shallow and deep copy operations
- t: * object: label vs. identity vs. value; * the id() function and the is operand; * shallow and deep copies of the objects. It’s hard to imagine writing a piece of Pytho... riables and objects, and possible ways of copying them. When you spot the following clause: <code pyth
- 5.1 Metaprogramming
- ramming technique in which computer programs have the ability to modify their own or other programs’ codes. It may sound like an idea from a science fiction story, but the idea was born and implemented in the early 1960s.
- 2.9 Inheriting properties from built-in classes
- properties from built-in classes Python gives you the ability to create a class that inherits propertie... 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 all of the well-known functionalities inherited from its parent or even parents and you c
- 2.2 Inheritance and polymorphism — Inheritance as a pillar of OOP
- eritance as 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). Inheritance creates a... a specific level of class hierarchy inherits all the traits (methods and attributes) defined inside an
- 2.5 Different faces of Python methods
- menting 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, ta
- 2.1 Python core syntax
- nary. 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 done by using the “+” operator, but on respective data types. Now, we'll use th
- 2.7 Encapsulation
- = Attribute encapsulation Encapsulation is one of the fundamental concepts in object-oriented programmi... nce, polymorphism, and abstraction). It describes the idea of bundling attributes and methods that work... es within a class. Encapsulation is used to hide the **attributes** inside a class like in a **capsule... preventing unauthorized parties' direct access to them. Publicly accessible **methods** are provided in
- 2.8 Composition vs Inheritance - two ways to the same destination
- = 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 ... fe issues. Inheritance is a great concept, one of the most important foundations of object-oriented pro... that models a tight relation between two classes: the base class and the derived class, called a subcla
- 1.2 Working with class and instance data – instance variables
- d and added to an object. This can be done during the object's initialization, performed by the __init__ method, or later at any moment of the object's life. Furthermore, any existing property can be removed at any time. Each object carries its
- 4.2 Serialization of Python objects using the pickle module
- = 4.2 Serialization of Python objects using the pickle module In this section, you will learn how to pe... st Python objects for later use. **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 '
- 1.1 Classes, Instances, Attributes, Methods — introduction
- 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 practices that go back to the very beginning of computer programming. This ver
- 2.6 Abstract classes
- programming language, but that doesn’t mean that there are no controls to impose a set of functionalit... act class** should be considered a blueprint 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 just declaring them, but not defining them in detail. Such methods a
- 2.3 Extended function argument syntax
- e talk about function arguments, we should recall the following facts: * some functions can be invok... e are assigning keywords to all argument values, otherwise positional ones are the first ones on the arguments list. Now let’s get familiar with the functions that can accept any arbit