In this chapter you’ll:
Create custom classes and objects of those classes.
Understand the benefits of crafting valuable classes.
Control access to attributes.
Appreciate the value of object orientation.
Use Python special methods __repr__
, __str__
and __format__
to get an object’s string representations.
Use Python special methods to overload (redefine) operators to use them with objects of new classes.
Inherit methods, properties and attributes from existing classes into new classes, then customize those classes.
Understand the inheritance notions of base classes (superclasses) and derived classes (subclasses).
Understand duck typing and polymorphism that enable “programming in the general.”
Understand class object
from which all classes inherit fundamental capabilities.
Compare composition and inheritance.
Build test cases into docstrings and run these tests with doctest
,
Understand namespaces and how they affect scope.