Could someone explain the output of given code and how python MRO works in this case?
class A(object):
def go(self):
print("go A go!")
class B(A):
def go(self):
super(B, self).go()
print("go B go!")
class C(A):
def go(self):
super(C, self).go()
print("go C go!")
class D(C, B):
def go(self):
super(D, self).go()
print("go D go!")
d = D()
d.go()
Output:
go A go!
go B go!
go C go!
go D go!
Following left-to-right and depth I would say it should be:
go A go!
go C go!
go D go!
but seems it dosn't work as I thought.