Cerca
Heus ací els resultats de la cerca.
Resultats de text complet:
- 1.2 Working with class and instance data – instance variables
- 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
- 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
- /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
- 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
- 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
- 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
- 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
- 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
- /code> <code ; output>Traceback (most recent call last): File "diamond.py", line 13, in class D(
- 2.5 Different faces of Python methods
- eated instances or the serial number given to the last produced object, or we modify the state of the c
- 2.7 Encapsulation
- 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
- 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
- lidating snippet into a function, reformulate the last condition, and use it as a helper function. <co
- 4.1 Shallow and deep copy operations
- copy a_dict = { 'first name': 'James', 'last name': 'Bond', 'movies': ['Goldfinger (1964)