Cerca

Heus ací els resultats de la cerca.

2.7 Encapsulation
82 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.
2.4 Decorators
72 Resultats, Darrera modificació:
the structure of related objects. Python is able to decorate functions, methods, and classes. The de... (i.e., the **decorated** function) as a parameter to the decorating function so that the **decorating*... ss or a decorating function. Decorators are used to perform operations before and after a call to a wrapped object or even to prevent its execution, depe
2.1 Python core syntax
60 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 strings together, which results i
3.1 Advanced techniques of creating and serving exceptions
59 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... tion has been raised) when it has no idea what do to with your code. What happens next? * the raised exception expects somebody or something to notice it and take care of it; * if nothing hap
4.1 Shallow and deep copy operations
52 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
2.9 Inheriting properties from built-in classes
51 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
5.1 Metaprogramming
48 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... in many cases metaprogramming allows programmers to minimize the number of lines of code to express a solution, in turn reducing development time. But t
1.1 Classes, Instances, Attributes, Methods — introduction
46 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.5 Different faces of Python methods
46 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... %'', and the ''get_internal()'' method allows you to read the instance variable specific to the indica
2.6 Abstract classes
44 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
39 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... s a** Vehicle. The primary use of inheritance is to reuse the code. If two classes perform similar ta
1.2 Working with class and instance data – instance variables
34 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.2 Inheritance and polymorphism — Inheritance as a pillar of OOP
34 Resultats, Darrera modificació:
tance creates a class hierarchy. Any object bound to a specific level of class hierarchy inherits all ... ) 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... e vs. multiple inheritance There are no obstacles to using multiple inheritance in Python. You can der
4.2 Serialization of Python objects using the pickle module
33 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
20 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
14 Resultats, Darrera modificació: