Learn now: https://edu.csdn.net/course/play/26676/399742?utm_source=blogtoedu
Class/instance view attributes: __dict__
Read-only properties of the class (instances cannot be added or modified): __slots__ to achieve optimized memory
Magic method:
__getattr__(), when the instance calls an attribute that does not exist in the class, in order to prevent the program loop from being aborted or exception handling, the operation of adding __getattr__() to the class can be added.
__setattr__(), when the attribute does not exist in the instance call class and the value is assigned, in order to prevent an error, the operation of __setattr__() can be added to the class. This method will add the non-existent attribute to the attribute list of the instance.