The Object System in the Python type perspective needs to be continuously learned, and we should pay attention to it when using it. Next we will look at how we can better use the Python type class. The following articles hope you will gain some benefits.
In a simple world of Python type, everything is an object. These objects can be divided into three types,
Metaclasses, classes, instance
Classes can be divided into built-in type and user-defined class.
The following is a detailed description of the image.
The definition of C is as follows (python inherits from a class and is directly written in parentheses after the class name ):
Class C (object):... the solid line indicates the relationship between is-kind-of, and the dotted line indicates the relationship between is-instance-.
When you view the base class of the current classes object (the instances object does not have the _ bases _ attribute), you can use classes_name. _ bases _. The value is a Tuple (Python supports multi-inheritance ).
The method for viewing the type of the current object is object_name. _ class __
We can use some tests to confirm the above figure:
All classes in the Python type class.