https://www.cnblogs.com/crazyrunning/p/7095014.html
写得很详细点个赞
我来举一个例子补充说明一下
class A: def test(self): print("test A") class B(A): def test(self): print("test B") class C(B): def test(self): print("test C") class D(A): def test(self): print("test D") class E(C, D): def test(self): print("test E") if __name__ == "__main__": e = E() print(E.__mro__)
结果是
(<class '__main__.E'>, <class '__main__.C'>, <class '__main__.B'>, <class '__main__.D'>, <class '__main__.A'>, <class 'object'>)