Cerca

Heus ací els resultats de la cerca.

4.3 Making Python objects persistent using the shelve module
6 Resultats, Darrera modificació:
eady for action, so let's insert a few items and close the shelve object. <code python> my_shelve['USD'... {'code':'Japanese yen', 'symbol': '¥'} my_shelve.close() </code> Now let's open the shelve file to dem... shelve_name) print(new_shelve['USD']) new_shelve.close() </code> The final code is presented in the ri... {'code':'Japanese yen', 'symbol': '¥'} my_shelve.close() new_shelve = shelve.open(shelve_name) print(n
2.4 Decorators
4 Resultats, Darrera modificació:
and %%**%%kwargs concepts. We can also employ a closure technique to persist arguments. The code pres... ould reference an object (own_function) in its enclosing scope thanks to the closure. == Decorators can accept their own attributes In Python, we can creat... extend its behavior. Decorators rely heavily on closures and *args and %%**kwargs%%. Interesting note
1.2 Working with class and instance data – instance variables
1 Resultats, Darrera modificació:
ny way. The word instance suggests that they are closely connected to the objects (which are class inst
2.5 Different faces of Python methods
1 Resultats, Darrera modificació:
be inconsistent with the convention and the code loses its effectiveness in communicating its own mean
2.8 Composition vs Inheritance - two ways to the same destination
1 Resultats, Darrera modificació:
extend. This phenomenon is known as the class explosion problem, and is one of the antipatterns of pro
2.9 Inheriting properties from built-in classes
1 Resultats, Darrera modificació:
that logs activities. But don’t worry, we’re not losing anything from the parent dictionary class, bec
3.1 Advanced techniques of creating and serving exceptions
1 Resultats, Darrera modificació:
riggers an additional exception. Should your code lose the information about the previous exception? Of