The creation of a new instance of a class happens when a running Python program encounters a call to that class, that is, the class name with a pair of parentheses after it, with zero or more arguments inside the parentheses.
Here is the general form:
The instance creation (also called instantiation) is handled by the
__init__() or constructor method.
First Python creates the instance with an empty
.__dict__ attribute that will
contain the instance's values.
Python then calls the constructor. The argument list
for this call always has the special first argument
self (the instance), followed by
whatever arguments were used in the initial call.
The constructor call is equivalent to this:
The constructor method then executes. Typically the constructor will set up new instance attributes by assignments of this form:
When the constructor finishes executing, the instance is returned to the constructor's caller.