One: The method description of the class
The method of class is divided into instance method, destructor method, construction method, class method, static method, attribute method, etc.
Both class and static methods can be called by class and class instances, and class instance methods can only be called by class instances
The implied invocation parameter of a class method is a class, and the implied invocation parameter of a class instance method is an instance of the class, and the static method does not implicitly invoke the argument
1) Instance method: The method that an instance of the class can use.
2) destructor: A method defined in a class using the Def __init__ (self), that is, the function is executed when the class is instantiated. Then we can put the attributes that we want to initialize first into this function.
3) Construction Method: __del__ "is a destructor, when using Del Delete object, will call his own destructor, in addition, when the object is called in a scope, the destructor will be called once when it jumps out of its scope, which can be used to free memory space
4) static method: is a normal function that is in the namespace defined by the class and does not operate on any instance type.
Use the adorner @staticmethod to define a static method. Both class objects and instances can call static methods.
Only nominal collation management, in fact, in a static method can not access any of the properties in the instance of the class
5) class method: A class method is a method of manipulating the class itself as an object. Class methods are defined using the @classmethod adorner. class method: Only class variables can be accessed and instance variables cannot be accessed
Two: Sample code
Python Basic Learning Log method for day6-class