1.调用mro 返回的是一个继承序列,super的继承顺序严格遵循mro继承序列
2.钻石继承 :多继承的情况下造成钻石继承
凡是继承object 对象的类都是新式类,python3默认所有的类都继承object类,都是新式类
python2 中 有新式类和 经典类 继承object才是经典类
mro的查找顺序: 新式类:广度优先 经典类:深度优先
多继承:默认从左向右继承顺序
# 新式类: class A(object): # def test(self): # print('from A') pass class B(A): # def test(self): # print('from B') pass class C(A): # def test(self): # print('from C') pass class D(B): # def test(self): # print('from D') pass class E(C): # def test(self): # print('from E') pass class F(D, E): # def test(self): # print('from F') pass # F-->D-->B-->E-->C-->A-->object # print(F.mro()) obj = F()
来源:https://www.cnblogs.com/bigbox/p/11939043.html