Cerca
Heus ací els resultats de la cerca.
Resultats de text complet:
- 4.1 PEP 257 – Docstring Conventions @info:cursos:pue:python-pcpp1:m2
- tion, and method definition in order to provide information about the functionality of a larger piece o... e blocks or sections. == Docstring vs. comments Before we move on, we need to understand this essential... ction (as their names suggest): comments are used for **commenting** your code, while docstrings are used for **documenting** your code. So, what is the differ
- 3.1 PEP 8 – Introduction @info:cursos:pue:python-pcpp1:m2
- at provides coding conventions (code style guide) for Python code. PEP 8 is considered one of the most important PEPs and a must-read for every professional Python programmer, as it helps... ines may be favored over the conventions provided for by PEP 8, especially in the case of any conflicts... and practices. In our case, it means we must not forget about one simple but important observation:**
- 1.7 Four magic letters: CRUD @info:cursos:pue:python-pcpp1:m4
- magic letters: CRUD == Entering a non-existing/malformed address We’ve reached the point in which we ar... k and how the HTTP server is able to do much more for us than just store and publish fancy images and f... ed and heavy databases or other services designed for storing and processing information. Moreover, the structure of the database (or the service) may vary,
- 2.1 PEP 20 – The Zen of Python @info:cursos:pue:python-pcpp1:m2
- at you see is a collection of some general truths for Python design rules and decision making. Even tho... the most explicit, concrete, specific one. Therefore, it’s sometimes a good idea to add more verbosit... at it’s easier to manage and handle. Example: Perform five additions of two numbers. {{ :info:cursos:... e too much code in one line, don’t fit too much information into a small amount of code, don’t write li
- 1.5 What is XML and why do we prefer to use JSON? @info:cursos:pue:python-pcpp1:m4
- ore and transfer documents of virtually any type. For example, the document format produced by MS Office applications (the newer one with file extensions en... ey are, although both the solutions were invented for nearly the same purpose. Take a look – it's a si... l - List of cars ready to sell --> <!DOCTYPE cars_for_sale SYSTEM "cars.dtd"> <cars_for_sale> <car>
- 1.1 SQLite @info:cursos:pue:python-pcpp1:m5
- o you know how that’s possible? Data is simply information about users, the contents of their posts, and comments. The data are all kinds of information that we can send to the application. During... ed. This place is a database, which is a set of information stored on a disk in a computer system. Acce... agement system (DBMS) is the software responsible for: * creating a database structure; * inserting
- 4.1 Logging in Python @info:cursos:pue:python-pcpp1:m5
- fault, Python and its modules provide many logs informing you of the causes of errors. However, it's go... system. When users visit your site, you can log information about the browsers they use. If something g... logs in different places. Most often it's in the form of a file, but it can also be an output stream, ... modules in which the dot separator is used. Their format is as follows: **hello** – creates a logger w
- 2.9 Inheriting properties from built-in classes @info:cursos:pue:python-pcpp1:m1
- the methods by delivering your own modifications for the selected methods. In the following example, ... , value) def extend(self, iterable): for element in iterable: IntegerList.chec... e have delivered: * a static, dedicated method for checking argument types. As we have delegated thi... a magic method (mind the underscores) responsible for inserting (overwriting) an element at a given pos
- 1.2 How to use sockets in Python @info:cursos:pue:python-pcpp1:m4
- network sockets. Of course, we'll harness Python for this purpose. Here are our goals: * we want t... nect to the HTTP server**. Our program has to perform the following steps: - **create a new socket*... /code> The user input may can take two different forms: * it can be **the domain name of the server... present all its capabilities - as we mentioned before, we aren't and won't be focusing on network prog
- 2.1 File processing - XML files @info:cursos:pue:python-pcpp1:m5
- 'll have to read or create a data file in the XML format. Soon, doing that will be a piece of cake. Th... rd Python library offers some interesting modules for working with XML: * **xml.etree.ElementTree** – has a very simple API for analyzing and creating XML data. It's an excellent choice for people who have never worked with the Document Ob
- 2.6 Abstract classes @info:cursos:pue:python-pcpp1:m1
- l to have some means of establishing requirements for classes in matters of interfaces (methods) expose... abstract class** should be considered a blueprint for other classes, a kind of contract between a __cla... er application, intended to support multiple file formats. Some of the formats are known now, but some are not yet known. The idea is to design an abstract
- 5.1 Metaprogramming @info:cursos:pue:python-pcpp1:m1
- dea was born and implemented in the early 1960s. For Python, code modifications can occure while the c... ut the truth is that this technique could be used for tool preparation; those tools could be applied to... e behavior of certain objects, a metaclass allows for the customization of class instantiation. The fu... ss definitions are read to create classes, well before classes are instantiated. Metaclasses usually e
- 1.2 Working with class and instance data – instance variables @info:cursos:pue:python-pcpp1:m1
- an be done during the object's initialization, performed by the __init__ method, or later at any moment... **%%__init__%%** creates an instance_var variable for the instance. The keyword self is used to indicat... s variable is created coherently and individually for the instance to make it independent from other in... ng the built-in __dict__ property that is present for every Python object. <code python> class Demo:
- 2.4 Decorators @info:cursos:pue:python-pcpp1:m1
- e the parameters of the decorated function and perform additional actions and that make it a real decor... a decorating function. Decorators are used to perform operations before and after a call to a wrapped object or even to prevent its execution, depending on... Function decorators Let's analyze some examples before we get down to the next dose of theory. So, let
- 2.2 Inheritance and polymorphism — Inheritance as a pillar of OOP @info:cursos:pue:python-pcpp1:m1
- pass</code> All the presented classes are empty for now, as we're going to show you how the mutual re... hat: * the **Vehicle** class is the superclass for both the **LandVehicle** and **TrackedVehicle** c... nce scenario, any specified attribute is searched for first in the current class. If it is not found, t... fine the method ''info()'', so Python has to look for it in the class hierarchy; * **class D** is con