Cerca
Heus ací els resultats de la cerca.
Resultats de text complet:
- 2.1 Python core syntax @info:cursos:pue:python-pcpp1:m1
- n strings, lists, integers, and floats. It’s natural for us to formulate expressions using algebraic s... every elevator has safety limits regarding the total weight it can lift. In this case, the '+' operat... s and return the corresponding result. If the total sum of the weights of the Person class objects do... on, these magic methods are sometimes called special purpose methods, because these methods are design
- 2.4 Decorators @info:cursos:pue:python-pcpp1:m1
- orator's operation is based on wrapping the original function with a new "decorating" function (or cla... e "decoration". This is done by passing the original function (i.e., the **decorated** function) as a ... ers of the decorated function and perform additional actions and that make it a real decorating function. The same principle is applied when we decorate
- 4.1 Logging in Python @info:cursos:pue:python-pcpp1:m5
- it can also be an output stream, or even an external service. To start logging, we need to import the ... = The Logger object One application may have several loggers created both by us and by programmers of ... the source of the logged message. **NOTE**: Several calls to the ''getLogger'' function with the same... e following logging levels are defined: * CRITICAL: 50 * ERROR: 40 * WARNING: 30 * INFO: 20
- 3.1 Advanced techniques of creating and serving exceptions @info:cursos:pue:python-pcpp1:m1
- the execution of a program that disrupts the normal flow of the program's instructions. Plan for the... , it: * stops your program; * creates a special kind of data, called an **exception**. Of course,... This is possible due to the fact that all potential exceptions have their unambiguous names, so you c... d that is why it is so important to know how to deal with exceptions. Python comes with 63((This numb
- 4.1 PEP 257 – Docstring Conventions @info:cursos:pue:python-pcpp1:m2
- hat are docstrings? A docstring is "a string literal that occurs as the first statement in a module, f... on. Such a docstring becomes the ''__doc__'' special attribute of that object." (PEP 257) In other wo... ore we move on, we need to understand this essential distinction (as their names suggest): comments ar... et/line.|Docstrings can be easily turned into actual documentation, which describes a module's or func
- 2.1 PEP 20 – The Zen of Python @info:cursos:pue:python-pcpp1:m2
- ppens? What you see is a collection of some general truths for Python design rules and decision makin... ssure you that the aphorisms are extremely practical and common sense, and you’re encouraged to accept... n, **anything above three** should be a clear signal that it’s maybe a good time to start refactoring ... lesser or greater extent, as one of the most crucial factors that should be kept in mind while creatin
- 2.9 Inheriting properties from built-in classes @info:cursos:pue:python-pcpp1:m1
- object? Imagine that you need to collect the serial numbers of sold tickets. Sound reasonable enough?... nding with ineligible element failed') print('Final result:', int_list) </code> Something that’s wo... s. To make our newly-created class fully functional, it’s necessary to deliver implementations for th... ailed Extending with ineligible element failed Final result: [49, 22, 2, 3] </code> In the next examp
- 2.6 Abstract classes @info:cursos:pue:python-pcpp1:m1
- ract methods. When we’re designing large functional units, in the form of classes, we should use an a... development is finished. Let's start with a typical class that can be instantiated: <code python> cla... odule containing the ABC class instead of your local file. This could cause some confusion – why does ... formation about the scanner (max. resolution, serial number) * Create an abstract class representing
- 1.2 Working with class and instance data – instance variables @info:cursos:pue:python-pcpp1:m1
- = Demo(200) print("d1's instance variable is equal to:", d1.instance_var) print("d2's instance variable is equal to:", d2.instance_var) </code> - **%%__init__%%... e hunting for bugs! The snippet contains additional comments for direct explanations. <code python> ... r class variable is used to keep track of the serial numbers (which in fact are also counters) of part
- 3.1 PEP 8 – Introduction @info:cursos:pue:python-pcpp1:m2
- mportant PEPs and a must-read for every professional Python programmer, as it helps to make the code m... grammer. PEP 8 is still evolving as new, additional conventions are being identified and included in ... ritten**. On the one hand, consistency is a crucial factor that determines code readability. On the o... the tool with the following command in the terminal: * <code python> pip install pycodestyle </co
- 2.5 Different faces of Python methods @info:cursos:pue:python-pcpp1:m1
- def __init__(self, value): self.__internal = value def get_internal(self): return self.__internal example1 = Example(10) example2 = Example(99) print(example1.get_internal()) print(example2.get_internal()) </code> Each o
- Python Professional Course Series: GUI Programming @info:cursos:pue:python-pcpp1:m3
- = Python Professional Course Series: GUI Programming == What is GUI? GUI is an acronym. Moreover, it’s... mmunicate bidirectionally. GUI stands for Graphical User Interface. In this three-word acronym, the U... ut what does it mean that the interface is graphical? We have to do a little time traveling to unders... d and completely separate device called a **terminal**. The terminal needed to be wired to a computer
- 1.5 What is XML and why do we prefer to use JSON? @info:cursos:pue:python-pcpp1:m4
- anguage, and although it is possible to build a real programming language on top of XML, it wasn't (an... its native niche. XML is – like JSON – a **universal and transparent carrier** of any type of data. Yo... be able to buy “just a car” here. They sell special cars for special owner at special prices adjusted to the prestige these cars bring. Moreover, the sto
- 2.8 Composition vs Inheritance - two ways to the same destination @info:cursos:pue:python-pcpp1:m1
- concept when modeling our classes to represent real-life issues. Inheritance is a great concept, one ... base class for them, to which we transfer identical methods and properties. This will facilitate test... tom, like tree roots, not branches. The most general, and the widest, class is always at the top (the ... es) you can create a huge, complex, and hierarchical structure of classes. This hierarchy would be ha
- 1.7 Four magic letters: CRUD @info:cursos:pue:python-pcpp1:m4
- tools and glue all these pieces into one functional block. You already know how HTTP works, how it’ i... rvice) may vary, e.g., it may be a simple relational database residing in a single file, or on the con... ies can utilize shared data through one, **universal interface**. The interface itself enables the us... a four-letter acronym which makes it really special. Let's shed some light on it. == C means Create