1. The special member method of the class 1.1__doc__ represents the description information of the class
1.2__module__ and __class__
__MODULE__ represents the object of the current operation in that module
__CLASS__ represents the class to which the current operation's object belongs
The 1.3__init__ constructor, when the object is created by the class, automatically triggers the 1.4__del__ destructor, which is automatically triggered when the function execution is complete. Automatic triggering when manually triggering 1.5__call__ object brackets in normal situations
Note: The execution of the construction method is triggered by the creation object, that is: Object = class name; for the execution of the __call__ method
Is triggered by an object followed by parentheses: Object () or Class () ()
1.6__dict__ viewing the member properties of a class or object
1.7__str__ if the __str__ method is defined in a class, the output object automatically triggers its return value
1.8__getitem__,__setitem__,__delitem__
Used for index operations, such as dictionaries, which are obtained, set, deleted, respectively
2. Create Class two ways
#type第一个参数:类名
#type第二个参数:当前类的基类
#type第三个参数:类的成员
The class's build call order is __new__---__call__--and __init__
3. Reflection
There are four ways to do this by using a string or by modifying the program's Running state:
Hasattr to determine whether a property exists
GetAttr Getting properties
SetAttr Setting properties
Delattr Deleting properties
Importing modules as strings
Import__import__('import_lib.metaclass'# This is the interpreter's own internal use of the #importlib.import_module (' Import_lib.metaclass ') #与上面这句效果一样, the official proposal with this
4. Exception Handling
5. Network programming
Python-socket Network Programming