Cerca

Heus ací els resultats de la cerca.

1.2 Working with class and instance data – instance variables
7 Resultats, Darrera modificació:
return message class FixedPhone(Phone): last_SN = 0 def __init__(self, number): super().__init__(number) FixedPhone.last_SN += 1 self.SN = 'FP-{}'.format(FixedPhone.last_SN) class MobilePhone(Phone): last_SN = 0 def __init__(self, number): super().__in
3.1 Advanced techniques of creating and serving exceptions
6 Resultats, Darrera modificació:
in the object. * **end** – the index after the last invalid data in the object. See the output of t... ges): <code ; output> Traceback (most recent call last): File "exceptions#030.py", line 6, in <module... exception occurred: Traceback (most recent call last): File "exceptions#030.py", line 8, in <module... se is a wide one and normally should be used as a last resort to catch all unhandled exceptions. It’s s
2.1 Python core syntax
2 Resultats, Darrera modificació:
/code> <code ; output>Traceback (most recent call last): File "core#010.py", line 11, in print(p... tation for the built-in integer type. Look at the last lines of the output – it contains information ab
2.3 Extended function argument syntax
2 Resultats, Darrera modificació:
amed *args and %%**%%kwargs) should be put as the last two parameters in a function definition. Their n... 50, 'argument2': '66'} <class 'dict'> </code> The last example in this section shows how to combine *ar
2.4 Decorators
2 Resultats, Darrera modificació:
ction.__name__)) return function </code> The last lines are responsible for both method invocation... bject – in our case it is a decorated class. The last thing we should do is decorate the Car class: <c
2.6 Abstract classes
2 Resultats, Darrera modificació:
lcome to Green Field! Traceback (most recent call last): (...) bp = BluePrint() TypeError: Can't in... lcome to Green Field! Traceback (most recent call last): (...) rf = RedField() TypeError: Can't ins
4.2 Serialization of Python objects using the pickle module
2 Resultats, Darrera modificació:
sted: <code ; output> Traceback (most recent call last): File "main.py", line 4, in <module> data... eive: <code ; output> Traceback (most recent call last): File "main.py", line 4, in <module> data
1.1 Classes, Instances, Attributes, Methods — introduction
1 Resultats, Darrera modificació:
ct (functions, modules, lists, etc.). In the very last section of this module, you'll see that even cla
2.2 Inheritance and polymorphism — Inheritance as a pillar of OOP
1 Resultats, Darrera modificació:
/code> <code ; output>Traceback (most recent call last): File "diamond.py", line 13, in class D(
2.5 Different faces of Python methods
1 Resultats, Darrera modificació:
eated instances or the serial number given to the last produced object, or we modify the state of the c
2.7 Encapsulation
1 Resultats, Darrera modificació:
member that this behavior is **unpythonic**. The last example could be presented with the behavior of
2.8 Composition vs Inheritance - two ways to the same destination
1 Resultats, Darrera modificació:
ct – we just arm it with a new component; * the last steps are about arming our old computer with a f
2.9 Inheriting properties from built-in classes
1 Resultats, Darrera modificació:
lidating snippet into a function, reformulate the last condition, and use it as a helper function. <co
4.1 Shallow and deep copy operations
1 Resultats, Darrera modificació:
copy a_dict = { 'first name': 'James', 'last name': 'Bond', 'movies': ['Goldfinger (1964)