related Code 1:
class A(object):
def show(self):
print ("init A...")
class B(A):
def show(self):
super(B, self).show()
print("init B...")
class C(A):
def show(self):
-sharp super(C, self).show()
print("init C...")
class D(B, C):
def show(self):
super(D, self).show()
print("init D...")
d = D()
d.show()
The result of output is
init C...
init B...
init D...
what I want to ask here is why I didn"t go through An and output init A.
.related Code 2:
class A(object):
def show(self):
print ("init A...")
class B(A):
def show(self):
super(B, self).show()
print("init B...")
class C(A):
def show(self):
-sharp super(C, self).show()
print("init C...")
class D(C, B): -sharp1
def show(self):
super(D, self).show()
print("init D...")
d = D()
d.show()
The result of output is
init C...
init D...
what I want to ask here is why the method in B has not been called?
there are also new MRO algorithms that use breadth-first search. How does it work here?