Fundamental to the life cycle of an object are its creation, initialization, and destruction. We'll defer creation and destruction to a later chapter on more advanced special methods and focus on initialization. This will set the initial state of the object.
The superclass of all classes, object, has a default implementation of __init__() that amounts to pass. We aren't required to implement __init__(). If we don't implement it, then no instance variables will be created when the object is created. In some cases, this default behavior is acceptable.
We can add attributes to an object that's a subclass of object. Consider the following class, which requires two instance variables, but doesn't initialize them:
class Rectangle: def area(self) -> float: return self.length * self.width
The Rectangle...