Can you please explain the following contradiction?
For this code:
class CL1(object):
def __init__(self):
super(CL1, self).__init__()
print "class 1"
class CL2(object):
def __init__(self):
#super(CL2, self).__init__()
print "class 2"
class CL3(CL2, CL1):
def __init__(self):
super(CL3, self).__init__()
print "class 3"
instance = CL3()
the output is:
class 2
class 3
However, if I uncomment the line:
#super(CL2, self).__init__()
I get the output:
class 1
class 2
class 3
I don't understand why applying to the superclass of CL2 invokes the constructor of CL1. CL1 is not the constructor of CL2.
The link: How does multiple inheritance work with the super() and different __init__() arguments? doesn't explain why the line:
#super(CL2, self).__init__()
invokes the constructor of a class that is not the superclass of the class calling it.