Cerca
Heus ací els resultats de la cerca.
Resultats de text complet:
- Python Professional Course Series: GUI Programming @info:cursos:pue:python-pcpp1:m3
- e, not saying a word about movies or animations. No photographs, no selfies, no avatars, no animated banners and finally, no colors. How do you like it? Take a look at the two cla
- 1.3 JSON – our new friend @info:cursos:pue:python-pcpp1:m4
- you want me to learn Java? Or even JavaScript?” No, we don't. Fortunately, the notation we want to t... * it uses **UTF-8 coded text** – this means that no machine/platform-dependent formats are used; it a... ** to those of Python. In general, you may expect no surprises when you use regular decimal integers, ... n in Python as None – it may be used to represent no value, or a value without any meaning. It is cal
- 2.7 Encapsulation @info:cursos:pue:python-pcpp1:m1
- ccount(self,account): raise AccountError("No es pot modificar un número de compte!") ... f.__balance != 0: raise AccountError("No es pot esborrar un compte amb saldo diferent de 0... if money < 0: raise AccountError("No es pot deixar el compte en negatiu") if (... f.__balance != 0: raise AccountError("No es pot esborrar un compte amb saldo diferent de 0
- 2.1 PEP 20 – The Zen of Python @info:cursos:pue:python-pcpp1:m2
- and responsible code development. There should be no exceptions that allow us to break the principles governing best coding practices. No special cases such as time pressure or complexity... e source of an error and debugging the program as no explicit error message is displayed in the consol... work under great time pressure and feel they have no time for testing. An important thing to keep in
- 1.2 Let TkInter speak! @info:cursos:pue:python-pcpp1:m3
- port tkinter as tk</code> Okay, we know there’s no accounting for taste, but it’s definitely worth a... *Tk()**. In its most commonly used form, it needs no arguments. The object returned by the method is *... sing the application to quit. Currently, there is no other way than to make use of some of the OS's de... k you? Of course we can. Does it change anything? No, it doesn't. Of course, the view of the button ch
- 1.6 Making life easier with the requests module @info:cursos:pue:python-pcpp1:m4
- from the data stream, hence it is just a string. No conversions are applied. The code produces the f... d server are aware of the fact that the contents (no matter which part sent them) contain a JSON messa... precisely specify its demands; if the client has no demands and initiates ''GET'' without resource id... l know the way. * ''DELETE'' – this name leaves no doubt: it is used to order the server to remove a
- 3.1 PEP 8 – Introduction @info:cursos:pue:python-pcpp1:m2
- ode and make it PEP 8 compliant.) * If there is no good reason for making the code PEP 8 compliant, ... servative in this matter, and requires you to use no more than 79 characters per line (72 for comments... nnot) use implicit relative imports, as these are no longer present in Python 3. You should also avoid... a string") strings. They’re the same, and there’s no special recommendation in PEP telling you which s
- 4.1 PEP 257 – Docstring Conventions @info:cursos:pue:python-pcpp1:m2
- g the hash sign (#). They should be rather brief (no more than 72 characters per line), begin with a c... n. Look at the following examples: <code python># No type information added: def hello(name): retu... your code is executed. * Since type hints have no effect on the source code, this means that they have no impact on performance times (characters are ignor
- 2.4 Shaping the main window and conversing with the user @info:cursos:pue:python-pcpp1:m3
- **title**. The title is defaultly set to ''Tk'', no matter what your application is named, or even if... the user or to ask any simple question (e.g., yes/no), you don’t need to create your own means – you c... rgument with identifiers like CANCEL, IGNORE, OK, NO, RETRY, and YES; * **icon** – sets the non-de... o show you is ''askyesno()'', designed to get yes/no user responses. The function creates a dialog whi
- 1.6 Events and how to handle them @info:cursos:pue:python-pcpp1:m3
- the switch if OFF, clicking the second button has no effect. Moreover, the second button’s title chang... = not switch def rhyme(dummy): global word_no, words word_no += 1 label.config(text=words[word_no % len(words)]) switch = True words = ["Old", "McDonald", "
- 2.2 Inheritance and polymorphism — Inheritance as a pillar of OOP @info:cursos:pue:python-pcpp1:m1
- le inheritance vs. multiple inheritance There are no obstacles to using multiple inheritance in Python... .melt() except AttributeError: print('No melt() method') </code> <code ; output> Wax can be used to form a tool Cheese can be eaten No melt() method </code> Both the Wax and Cheese classes own melt() methods, but there is no relation between the two. Thanks to duck typing,
- 1.2 How to use sockets in Python @info:cursos:pue:python-pcpp1:m4
- will be referenced by a variable named ''sock''. No, it's not about the clothes. Really. == Connecti... why 80? Can I put something else instead of this? No, you can’t. 80 is a well-known service number for... hispered directly into the server's ear: "We have no more to say to you. We don't want to hear from yo... has entered a non-existent or malformed address (no matter whether it’s expressed as a domain name or
- 1.1 Classes, Instances, Attributes, Methods — introduction @info:cursos:pue:python-pcpp1:m1
- ta with the code. If you run the code, there are no visible effects. The class has been defined, but there is no code making use of it — that’s why you see no effects. === instance An instance is one particular ph
- 2.6 Abstract classes @info:cursos:pue:python-pcpp1:m1
- ng language, but that doesn’t mean that there are no controls to impose a set of functionalities or an... example of creating a class and instantiating it. No errors, no doubts, and it gives a clear output: <code ; output> Nothing is blue unless you need it </
- 4.2 Serialization of Python objects using the pickle module @info:cursos:pue:python-pcpp1:m1
- out: pickle.dump(f1, file_out) </code> We see no errors, so we might conclude that ''f1()'' was pi... () </code> Unfortunately, the result proves that no code was persisted: <code ; output> Traceback (mo... : pickle.dump(cucu, file_out) </code> We see no errors, so we might conclude that the ''Cucumber'