to

Cerca

Heus ací els resultats de la cerca.

2.4 Decorators
203 Resultats, Darrera modificació:
= 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 fu
2.1 Python core syntax
130 Resultats, Darrera modificació:
e been using Python core operations that allow us to operate on strings, lists, integers, and floats. It’s natural for us to formulate 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 string
2.7 Encapsulation
94 Resultats, Darrera modificació:
attributes within a class. Encapsulation is used to hide the **attributes** inside a class like in a ... *, preventing unauthorized parties' direct access to them. Publicly accessible **methods** are provided in the class **to access** the values, and other objects call those methods to retrieve and modify the values within the object.
5.1 Metaprogramming
74 Resultats, Darrera modificació:
= 5.1 Metaprogramming == Introduction to metaclasses Metaprogramming is a programming 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 e... e already experienced it while implementing decorators, overriding operators, or even implementing the
3.1 Advanced techniques of creating and serving exceptions
70 Resultats, Darrera modificació:
ns. Plan for the module: * short introduction to exceptions; * review of the named attributes of exception objects; * introduction to chained exceptions; * analysis of the traceback... s a situation that it cannot cope with, it: * stops your program; * creates a special kind of dat... tion has been raised) when it has no idea what do to with your code. What happens next? * the rais
2.9 Inheriting properties from built-in classes
67 Resultats, Darrera modificació:
rom 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 parent's attr... t you need such an object? Imagine that you need to collect the serial numbers of sold tickets. Sound... also validate the type of elements that are about to be placed onto it. Such a list can be used in an
4.1 Shallow and deep copy operations
66 Resultats, Darrera modificació:
deep operations In this module, you’ll learn how to copy Python objects. Specifically, you'll learn a... hallow and deep copies of the objects. It’s hard to imagine writing a piece of Python code that perfo... variables are fundamental elements that allow us to cope with objects, let's talk in detail about var... r name binding, is created, and this label refers to a distinct place in the computer memory. What is
1.2 Working with class and instance data – instance variables
60 Resultats, Darrera modificació:
and only when it is explicitly created and added to an object. This can be done during the object's i... 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 th
2.5 Different faces of Python methods
60 Resultats, Darrera modificació:
hasizing 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 instanc... must have previously existed. The code in the editor demonstrates the idea presented above. <code py
2.6 Abstract classes
57 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 ... tem in a group of programmers, it would be useful to have some means of establishing requirements for ... lled **abstract methods**. * The programmer has to deliver all method definitions and the completene
2.8 Composition vs Inheritance - two ways to the same destination
57 Resultats, Darrera modificació:
= 2.8 Composition vs Inheritance - two ways to the same destination So far we've been using and follo... the inheritance concept when modeling our classes to represent real-life issues. Inheritance is a grea... operties of the base class, and allows a subclass to extend everything that has been inherited. By ext... called an **is a** relation. Examples: * a Laptop **is a** (specialized form of) Computer; * a S
1.1 Classes, Instances, Attributes, Methods — introduction
50 Resultats, Darrera modificació:
ttributes, Methods — introduction == Introduction to Object-Oriented Programming This module addresses... n evolution of good design practices that go back to the very beginning of computer programming. This... mputer applications because it allows programmers to model entities representing real-life objects. Moreover, OOP allows programmers to model interactions between objects in order to so
2.2 Inheritance and polymorphism — Inheritance as a pillar of OOP
46 Resultats, Darrera modificació:
tance creates a class hierarchy. Any object bound to a specific level of class hierarchy inherits all ... rom scratch, but by using an already defined repertoire of traits. The new class inherits (and this is... ) all the already existing equipment, but is able to add some new features if needed. Each subclass i... esented classes are empty for now, as we're going to show you how the mutual relations between the sup
4.2 Serialization of Python objects using the pickle module
35 Resultats, Darrera modificació:
pickle module In this section, you will learn how to persist Python objects for later use. **Pickling... food. The resulting food is called a pickle, and to prevent ambiguity, prefaced with the 'pickled' ad... data processing for later use? The simplest way to persist outcomes is to generate a flat text file and to write your outcomes. It’s a very simple thing
2.3 Extended function argument syntax
21 Resultats, Darrera modificació:
c number of arguments with no exclusions; we have to pass a required number of arguments in an imposed order to follow function definition; * functions might h... ult values for some parameters, so we do not have to pass all arguments as missing arguments, complete... guments in any order if we are assigning keywords to all argument values, otherwise positional ones ar
4.3 Making Python objects persistent using the shelve module
16 Resultats, Darrera modificació: