Cerca

Heus ací els resultats de la cerca.

2.4 Decorators @info:cursos:pue:python-pcpp1:m1
42 Resultats, Darrera modificació:
dose of theory. So, let's create a function – ''simple_hello()'' is one of the simplest functions we could think of. We'll decorate it in a moment. <code python> def simple_hello(): print("Hello from simple function!") </code> <code python> def simple_decorator(fun
2.1 PEP 20 – The Zen of Python @info:cursos:pue:python-pcpp1:m2
28 Resultats, Darrera modificació:
e. In Python, it’s preferred to use not only the simplest way to express a programming idea, but also... python-pcpp1:m2:pasted:20231105-125726.png }} == Simple is better than complex Simplicity is the key to success. A **simpler solution** is usually preferred over a complex one, and g
1.2 How to use sockets in Python @info:cursos:pue:python-pcpp1:m4
26 Resultats, Darrera modificació:
rite **a program which reads the address of a WWW site** (e.g., pythoninstitute.org) using the standar... oot document** (the main HTML document of the WWW site) of the specified site; * the program **outputs the document** to the screen; * the program **u... t will contain the requested root document of the site) - **close the socket** (end the connection)
3.1 PEP 8 – Introduction @info:cursos:pue:python-pcpp1:m2
19 Resultats, Darrera modificació:
n our case, it means we must not forget about one simple but important observation:** our code will be... n Python, you should remember to follow these two simple rules: * Use **four spaces per indentation... evel_function(): return None </code> * **a single blank line** to surround method definitions i... d and should only be used for test purposes or in situations where your comments or docstrings use a n
2.4 Shaping the main window and conversing with the user @info:cursos:pue:python-pcpp1:m3
15 Resultats, Darrera modificació:
r you choose. If you want your main window to be sized in a non-default way, you have to use a low-le... o use it. Look – clicking the window changes its size, and the window gets bigger and smaller periodi... port tkinter as tk def click(*args): global size, grows if grows: size += 50 if size >= 500: grows = False else:
1.3 JSON – our new friend @info:cursos:pue:python-pcpp1:m4
13 Resultats, Darrera modificació:
opment is in fact based on TLA. What is TLA? It's simple – it's a Three-Letter Acronym. Close your eye... fferent types, including other objects) or even a single value in a way that can survive network trans... m conversions. JSON solves the problem using two simple tricks: * it uses **UTF-8 coded text** – t... able) and comprehensible by humans; * it uses a simple and not very expanded **format** (we can call
2.2 Inheritance and polymorphism — Inheritance as a pillar of OOP @info:cursos:pue:python-pcpp1:m1
12 Resultats, Darrera modificació:
ython-pcpp1:pasted:20231013-035718.png }} A very simple example of two-level inheritance is presented... cle** classes. == Inheritance and polymorphism — Single inheritance vs. multiple inheritance There ar... nheritance should be used with more prudence than single inheritance because: * a single inheritance class is always simpler, safer, and easier to unde
4.1 PEP 257 – Docstring Conventions @info:cursos:pue:python-pcpp1:m2
12 Resultats, Darrera modificació:
be turned into documentation; their purpose is to simplify the code, provide precise information, and ... important? Essentially, we must not forget this simple rule by Guido van Rossum: "**Code is more oft... hat comments in Python are created using the hash sign (#). They should be rather brief (no more than ... ne comment, in which case you should use the hash sign at the beginning of each line of comment. Gene
1.6 Making life easier with the requests module @info:cursos:pue:python-pcpp1:m4
12 Resultats, Darrera modificació:
ren't able to avoid them) and we also need a tool simpler than the ''socket'' module to talk with the ... ckage manager) you should see a short help screen similar to the one presented here: {{ :info:cursos:p... response. As you can see, the code is extremely **simple and compact** – we don't need to cope with a ... works as expected, you will see a very short and simple result:<code>200</code> As the HTTP protocol
2.8 Composition vs Inheritance - two ways to the same destination @info:cursos:pue:python-pcpp1:m1
11 Resultats, Darrera modificació:
ance is to reuse the code. If two classes perform similar tasks, we can create a common base class for... f constructing adaptable objects. You can achieve similar goals by using a concept named composition. ... e code to see how composition works. Look at the simple code presented in the editor pane. <code pyt... et_pressure()'', ''pump()''; attribute available: size * engine; methods available: ''start()'', '
4.2 Serialization of Python objects using the pickle module @info:cursos:pue:python-pcpp1:m1
11 Resultats, Darrera modificació:
utput of your data processing for later use? The simplest way to persist outcomes is to generate a fl... text file and to write your outcomes. It’s a very simple thing to do way which is not suitable for per... rint(data2) </code> The presented code is quite simple: * we’re importing a pickle module; * th... ct, returns the initial object. An example of in situ serialization and deserialization is presented
1.2 Let TkInter speak! @info:cursos:pue:python-pcpp1:m3
11 Resultats, Darrera modificació:
ow it works. We’ll do it step-by-step. Ready The simplest (and at the same time the less controllable... an enthusiast of living life on the edge, you can simplify your import (but not the rest of your work)... ndow's method, named **mainloop()**. The name is significant because – as you can see – there is noth... cupied by the upper-left corner; * the widget's size is defaultly determined by the constructor in o
Python Professional Course Series: GUI Programming @info:cursos:pue:python-pcpp1:m3
9 Resultats, Darrera modificació:
to different screen areas and acted in a way very similar to a mouse. But believe us – you don't want... swer was given by pressing a set of allowed keys. Simple? Simple. From our present-day developer's perspective, too simple. From a user's point of view, difficult and i
1.7 Four magic letters: CRUD @info:cursos:pue:python-pcpp1:m4
9 Resultats, Darrera modificació:
base (or the service) may vary, e.g., it may be a simple relational database residing in a single file, or on the contrary, a huge, distributed cloud of c... HTTP method. Now we’re ready to carry out some simple but instructive experiments with JSON. We’ll ... ean value; * the initial file contains data for six cars – don't be surprised if the server modifies
1.1 SQLite @info:cursos:pue:python-pcpp1:m5
9 Resultats, Darrera modificació:
years. Do you know how that’s possible? Data is simply information about users, the contents of thei... : The sqlite3 module has been available in Python since version 2.5. == sqlite3 – creating a database As we already said, the SQLite database is a single file, which is saved on your computer. Each f... ce a standard that would standardize its syntax. Since the first production deployments, the followin
4.1 Shallow and deep copy operations @info:cursos:pue:python-pcpp1:m1
8 Resultats, Darrera modificació:
1.7 Visiting widgets’ properties @info:cursos:pue:python-pcpp1:m3
8 Resultats, Darrera modificació:
5.1 The configparser module @info:cursos:pue:python-pcpp1:m5
7 Resultats, Darrera modificació:
2.1 Python core syntax @info:cursos:pue:python-pcpp1:m1
6 Resultats, Darrera modificació:
1.5 A simple GUI application @info:cursos:pue:python-pcpp1:m3
6 Resultats, Darrera modificació:
1.4 Talking to JSON in Python @info:cursos:pue:python-pcpp1:m4
6 Resultats, Darrera modificació:
2.1 File processing - XML files @info:cursos:pue:python-pcpp1:m5
6 Resultats, Darrera modificació:
3.1 The CSV module in Python @info:cursos:pue:python-pcpp1:m5
6 Resultats, Darrera modificació:
2.5 Different faces of Python methods @info:cursos:pue:python-pcpp1:m1
4 Resultats, Darrera modificació:
2.6 Abstract classes @info:cursos:pue:python-pcpp1:m1
3 Resultats, Darrera modificació:
2.7 Encapsulation @info:cursos:pue:python-pcpp1:m1
3 Resultats, Darrera modificació:
5.1 Metaprogramming @info:cursos:pue:python-pcpp1:m1
3 Resultats, Darrera modificació:
1.8 Interacting with widget methods @info:cursos:pue:python-pcpp1:m3
3 Resultats, Darrera modificació:
4.1 Logging in Python @info:cursos:pue:python-pcpp1:m5
3 Resultats, Darrera modificació:
2.3 Extended function argument syntax @info:cursos:pue:python-pcpp1:m1
2 Resultats, Darrera modificació:
2.5 Working with the Canvas @info:cursos:pue:python-pcpp1:m3
2 Resultats, Darrera modificació:
1.1 What is PEP? @info:cursos:pue:python-pcpp1:m2
1 Resultats, Darrera modificació:
1.4 Coloring your widgets @info:cursos:pue:python-pcpp1:m3
1 Resultats, Darrera modificació:
1.6 Events and how to handle them @info:cursos:pue:python-pcpp1:m3
1 Resultats, Darrera modificació:
1.9 Looking at variables @info:cursos:pue:python-pcpp1:m3
1 Resultats, Darrera modificació: