Python class:
Divided into new and old classes (also called Classic classes):
The difference is:
The new class inherits at least from a parent class (at least inherit from the object class)
The classic class does not specify a parent class
The class is abstract and is an instance factory.
An instance is an instance of a class (a bit of a detour).
method must be bound to an instance to be called. Even if the class method is called directly in the instance, it is invoked through an instance.
The method parameters of the class (in this case, the general method) are simply passing parameters other than self. As in other languages, this parameter does not need to be passed. Static and class methods are different, where class methods require passing class parameters.
The __init__ method is called during instantiation. But __init__ is not a real constructor (though there are similar places).
After python has defined the class, it invokes the __init__ method to set the initial value of the instance or to do some preliminary diagnostic code to instantiate the class. The main thing is to perform certain tasks or settings after the instance is created, before returning the instance object.
However, it is not recommended to put the print statement in the method (including the __init__ method).
Python Class One: overview