MRO (Method Resolution Order)#
[4]:
class A:
def hello(self) -> str:
return "a"
class B:
def hello(self) -> str:
return "b"
class C(A, B):
pass
# Search order C -> A -> B -> object
print(C().hello())
print(C.__mro__)
a
(<class '__main__.C'>, <class '__main__.A'>, <class '__main__.B'>, <class 'object'>)