Python中的多重继承

2021-03-01 22:26

阅读:512

标签:优先   广度优先   继承   pass   print   class   python   python3   查看   

class P1:
    pass


class P2:
    pass


class P3:
    pass


class A(P1, P2):
    pass


class B(P1, P3):
    pass


class C(P3, P2):
    pass


class D(A, B, C):
    pass


d = D()
print(D.__mro__)
# 查看 D类的多重继承的搜索顺序: D.__mro__
#python3中都是新式类,遵循的搜索原则是 广度优先

结果

(, , , , , , , )

Python中的多重继承

标签:优先   广度优先   继承   pass   print   class   python   python3   查看   

原文地址:https://www.cnblogs.com/kevin1220/p/14427783.html


评论


亲,登录后才可以留言!