The difference is with: the location saved in memory is different
Instance properties belong to the object
class attribute belongs to class
Instance properties need to be accessed through objects, and class properties are accessed through classes
Only one copy of class attributes is stored in memory, and one copy of instance attributes is stored in each object - when creating instance objects through classes, if each object needs attributes with the same name, then use class attributes and use one copy Just
2. Instance methods, static methods, and class methods
All three methods belong to the class in memory, but they are called differently
Instance method: called by the object; at least one self parameter; when the instance method is executed, the object that calls the method is automatically assigned to self; class method: called by the class; at least one cls parameter; when the class method is executed, the method will be automatically called The class is assigned to cls; static method: called by the class; no default parameters;