I was trying to understand how super works in python and tried the following example:
class A(object):
def __init__(self):
print "in A's init"
class B(object):
def __init__(self):
print "in B's init"
class C(A,B):
def __init__(self):
super(C,self).__init__()
print "In C"
if __name__=="__main__":
c=C()
fairly simple.. And I tried the following super calls(displayed with the results here):
>>> super(B,c).__init__()
>>> super(B,c).__init__()
>>> super(A,c).__init__()
in B's init
>>> super(A,c).__init__()
in B's init
>>> super(A,c).__init__()
in B's init
>>> super(B,c).__init__()
>>> super(C,c).__init__()
in A's init
I do not understand why does super(A,c).__init__()
print out that its in B's init??