Cerca
Heus ací els resultats de la cerca.
Resultats de text complet:
- 5.1 Metaprogramming @info:cursos:pue:python-pcpp1:m1
- = 5.1 Metaprogramming == Introduction to metaclasses Metaprogramming is a programming technique in whi... Another example of metaprogramming is the **metaclass** concept, which is one of the most advanced co... en of Python**, expressed his feelings about metaclasses in the **comp.lang.python** newsgroup on 12/22/2002: //[metaclasses] are deeper magic than 99% o
- 2.2 Inheritance and polymorphism — Inheritance as a pillar of OOP @info:cursos:pue:python-pcpp1:m1
- nheritance and polymorphism — Inheritance as a pillar of OOP Inheritance is one of the fundamental con... nted programming, and expresses the fundamental relationships between classes: superclasses (parents) and their subclasses (descendants). Inheritance creates a class hierarchy
- 1.2 Working with class and instance data – instance variables @info:cursos:pue:python-pcpp1:m1
- = 1.2 Working with class and instance data – instance variables == Instance variables This kind of var... tialization, performed by the __init__ method, or later at any moment of the object's life. Furthermor... are closely connected to the objects (which are class instances), not to the classes themselves. To get access to the instance variable, you should addre
- 2.6 Abstract classes @info:cursos:pue:python-pcpp1:m1
- = 2.6 Abstract classes Python is considered to be a very flexible programming language, but that doesn’t mean that there are no co... impose a set of functionalities or an order in a class hierarchy. When you develop a system in a group... have some means of establishing requirements for classes in matters of interfaces (methods) exposed by
- 2.4 Decorators @info:cursos:pue:python-pcpp1:m1
- 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 wrapp... al function with a new "decorating" function (or class), hence the name "decoration". This is done by ... ng function returns a function that can be called later. Of course, the **decorating** function does
- 1.1 Classes, Instances, Attributes, Methods — introduction @info:cursos:pue:python-pcpp1:m1
- = 1.1 Classes, Instances, Attributes, Methods — introduction == Introduction to Object-Oriented Progra... with OOP, and even the mouse cursor image is displayed using an application created with OOP. The sam... should agree on the following definitions: * class — an idea, blueprint, or recipe for an instance; * instance — an instantiation of the class; very often used interchangeably with the term
- 2.5 Different faces of Python methods @info:cursos:pue:python-pcpp1:m1
- rations on the instances (objects), and in particular the attributes of the instance, so we’ve called ... strates the idea presented above. <code python> class Example: def __init__(self, value): ... le2.get_internal()) </code> Each of the Example class objects has its own copy of the instance variab... <code ; output> 10 99 </code> == The static and class methods Two other types of method can also be u
- 2.8 Composition vs Inheritance - two ways to the same destination @info:cursos:pue:python-pcpp1:m1
- lowing the inheritance concept when modeling our classes to represent real-life issues. Inheritance is... object-oriented programming 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 subcl
- 4.1 PEP 257 – Docstring Conventions @info:cursos:pue:python-pcpp1:m2
- conventions**, best practices, and semantics (not laws or regulations!) associated with documenting Python code using docstrings. In short, it tries to an... rs as the first statement in a module, function, class, or method definition. Such a docstring becomes... n **documentation strings** that are used in the class, module, function, and method definition in ord
- 2.7 Encapsulation @info:cursos:pue:python-pcpp1:m1
- = 2.7 Encapsulation == Attribute encapsulation Encapsulation is one of the fundamental concepts in object-oriented programming (amongst inherita... d methods that work on those attributes within a class. Encapsulation is used to hide the **attribute
- 3.1 PEP 8 – Introduction @info:cursos:pue:python-pcpp1:m2
- * Documentation: https://pycodestyle.pycqa.org/en/latest/ * You can also install **autopep8** to aut... ble to use it, you need the //pycodestyle// installation on your machine in order to indicate those pa... style guidelines. The online tool is built using Flask, Twitter Bootstrap, and the PEP8 module (the ve... pep8online.com/about == Recommendations for Code Layout PEP 8 is supposed to make your coding experie
- 2.1 PEP 20 – The Zen of Python @info:cursos:pue:python-pcpp1:m2
- time major contributor to the Python programming language and Python community, wrote this 19-line po... aximum line length, variable naming conventions, placing statements on separate lines, and many others. Example: Write a program that calculates the hypotenuse of a right-angled triangle. {{... enever you want to use an implicit feature of the language, ask yourself whether you really need it. M
- 2.1 Python core syntax @info:cursos:pue:python-pcpp1:m1
- integers, and floats. It’s natural for us to formulate expressions using algebraic symbols representin... different** data types, when operations are formulated using **the same** operators or instructions, ... str(), len() * reflexion – isinstance(), issubclass() and a few more elements. Python allows us t... agine the following situation: you've created a class that represents a person; each instance of the
- 2.3 A small lexicon of widgets - Part 3 @info:cursos:pue:python-pcpp1:m3
- racer remembers its **previous** state (using the last_s variable) and restores the field to this stat... kinter as tk def digits_only(*args): global last_string string = text.get() if string ==... g.isdigit(): # Field's content is valid. last_string = string else: text.set(last_string) last_string = '' window = tk.Tk() text =
- 2.9 Inheriting properties from built-in classes @info:cursos:pue:python-pcpp1:m1
- = 2.9 Inheriting properties from 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 attributes or methods. As a result, your n