el

Cerca

Heus ací els resultats de la cerca.

2.7 Encapsulation
57 Resultats, Darrera modificació:
the behavior of a class representing a water or fuel tank: It would not be wise to pour any amount of... l tank capacity, or request setting the liquid level to a negative value. Python allows you to contro... self.capacity = capacity self.__level = 0 @property def level(self): return self.__level @level.setter def level(
3.1 Advanced techniques of creating and serving exceptions
28 Resultats, Darrera modificació:
): File "exceptions#050.py", line 10, in personnel_check print("\tThe navigator's name is", crew... File "exceptions#050.py", line 19, in personnel_check() File "exceptions#050.py", line 12, in personnel_check raise RocketNotReadyError('Crew is inco... etNotReadyError(Exception): pass def personnel_check(): try: print("\tThe captain's
2.8 Composition vs Inheritance - two ways to the same destination
10 Resultats, Darrera modificació:
def start(self): print('Starting {}hp diesel engine'.format(self.hp)) my_car = Car(GasEngine... wo different kinds of engine – a gas one or a diesel one. The developer's responsibility is to provide... output> Starting 4hp gas engine Starting 2hp diesel engine </code> To favor composition over inherit... stop()'', ''get_state()''; attribute available: fuel type * vehicle; method available: ''%%__init_
1.1 Classes, Instances, Attributes, Methods — introduction
8 Resultats, Darrera modificació:
applications because it allows programmers to model entities representing real-life objects. Moreover, OOP allows programmers to model interactions between objects in order to solve re... llows for variables to be used at the instance level or the class level. Those used at the instance level are referred to as **instance variables**, where
4.1 Shallow and deep copy operations
6 Resultats, Darrera modificació:
Specifically, you'll learn about: * object: label vs. identity vs. value; * the id() function and... inally a variable, which you should treat as a label or name binding, is created, and this label refers to a distinct place in the computer memory. What ... bject 'identity'? Why are the object value and label not enough? The built-in ''id()'' function retur
2.2 Inheritance and polymorphism — Inheritance as a pillar of OOP
4 Resultats, Darrera modificació:
lass hierarchy. Any object bound to a specific level of class hierarchy inherits all the traits (metho... 13-035718.png }} A very simple example of two-level inheritance is presented here: <code python>clas... into the direct parent classes in depth-first level (the first level above), from the left to the right, according to the class definition. This is the r
2.6 Abstract classes
4 Resultats, Darrera modificació:
def scan_document(self): print("El document ha estat escanejat") def get_scanner... r) ) def print_document(self): print("El document ha estat imprés") def get_printer_st... def scan_document(self): print("El document ha estat escanejat") def get_scanner... r) ) def print_document(self): print("El document ha estat imprés") def get_printer_st
2.1 Python core syntax
1 Resultats, Darrera modificació:
fer to https://docs.python.org/3/reference/datamodel.html#special-method-names. What are some real li
4.3 Making Python objects persistent using the shelve module
1 Resultats, Darrera modificació:
s when applied to a Python dictionary; * the ''del'' instruction, used to delete a key-value pair.