【3.5】类和实例属性的查找顺序--mro查找

 1 class D(object):
 2     pass
 3 
 4 
 5 class C(D):
 6     pass
 7 
 8 
 9 class B(D):
10     pass
11 
12 
13 class A(B, C):
14     pass
15 
16 
17 print(A.__mro__)

利用__mro__属性可以答应出查找顺序

(<class '__main__.A'>, <class '__main__.B'>, <class '__main__.C'>, <class '__main__.D'>, <class 'object'>)

  

posted @ 2019-07-23 20:44  _simpleSmile  阅读(265)  评论(0编辑  收藏  举报