Cerca
Heus ací els resultats de la cerca.
Resultats de text complet:
- 5.1 Metaprogramming
- the type of the metaclass ''type'' is ''type'' – no, that is not a typo. {{ :info:cursos:pue:python-... 's values. In ''My_Class1'', by design, there is no ''greetings'' function, so when the class is cons... created by a group of volunteers who worked with no clear “clean coding” rules; * the system suffer... ion_time = time.time() return obj class Uno(metaclass=MetaClassInstantation): pass class
- 2.7 Encapsulation
- 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.2 Inheritance and polymorphism — Inheritance as a pillar of OOP
- 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.1 Classes, Instances, Attributes, Methods — introduction
- 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
- 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
- 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'
- 1.2 Working with class and instance data – instance variables
- modifying the instance variable of any object has no impact on all the remaining objects. Instance var... nt(d2.class_var) print('.' * 20) # d1 object has no instance variable print('contents of d1:', d1.__d
- 2.5 Different faces of Python methods
- t should consist of alphanumerical characters, so no space characters are allowed; * if the text doe... dedicated static method. * Create a watch with no engraving * Create a watch with correct text fo
- 3.1 Advanced techniques of creating and serving exceptions
- or that an exception has been raised) when it has no idea what do to with your code. What happens nex... name) print(e.path) </code> <code ; output> ("No module named 'abcdefghijk'",) abcdefghijk None </
- 2.1 Python core syntax
- a number or string to an integer, or return 0 if no arguments | are given. If x is a number, retur
- 2.3 Extended function argument syntax
- s may require a specific number of arguments with no exclusions; we have to pass a required number of
- 2.4 Decorators
- n instance. The original class named 'MyClass' is no longer available in your name space. The callable
- 2.8 Composition vs Inheritance - two ways to the same destination
- with a more advanced connection device. There is no need to recreate the computer object – we just ar