The new class is the class person (object): This form, from the beginning of the py2.2
The new class adds:
is the attribute's name. is the attribute's docstring. __get__ (object is fromobject. __set__ (objectObject to value.__delete__ (objectobject.
The emergence of the new class, in addition to a large number of methods, but also changed the classic Class A multi-inheritance bug, because it uses a breadth-first algorithm
23. The default is the new class in X, and the classic class is removed without having to explicitly inherit the object
Paste a section of the official online author explained
If there is a Save method in the classic class, and C overrides the Save () method, then the search order is d->b->a and will never find C.save ()
Code Demo:
#!/usr/bin/Env Python3#coding:utf-8" "the difference between the new class and the classic class, multiple inheritance code demo" "classa:def __init__ (self): print'This is A'def Save (self): print'Save method from A'classb:def __init__ (self): print'This is B'classc:def __init__ (self): print'This is c'def Save (self): print'Save method from C'classD (B, C): Def __init__ (self): print'This is D'D=D () d.save ()
The results show A,
Note: In later versions of Python3, the new class is used by default and will not succeed
The difference between the new class and the classic class of 03-python