First, the formal difference, the instance method implies the class instance self, and the class method implies that the class itself is CLS. Static methods have no implicit arguments, and they can also be called directly to a class instance.
So logically, the class method is called by the class, the instance method is called by the instance, and both of the static methods can be called. The main difference is the difference in parameter passing, where the instance method silently passes the self reference as a parameter, and the class method silently passes the CLS reference as the parameter.
Next see if the class and instance can invoke the Classes property
Therefore, the instance method (ordinary method) should be called by the instance, the class cannot be called;
A class method can be called by a class, and it can be called by an instance because the parameter CLS is passed in.
Static methods can both be called
summed up into a table is:
Note the difference between the result of a class instance method call and the result of a static method call:
Instance methods (common methods) —————————————————————— change as instance properties change
A class method (whether a class call or an instance call) ——————————————— is the value of a class property and does not change with instance properties
Static methods ———————————————————————————— can not access the class properties, so directly output the value of the incoming method
A detailed description of Python's class methods, common methods and static methods