I have the following code:
class TestA(object):
def __init__(self, *args):
super(TestA, self).__init__()
print 'TestA'
class TestB(object):
def __init__(self, my_var=None):
super(TestB, self).__init__()
print 'TestB', my_var
class TestC(object):
def __init__(self, my_var=None):
super(TestC, self).__init__()
print 'TestC', my_var
class TestD(TestB, TestA, TestC):
def __init__(self):
print 'TestD'
super(TestD, self).__init__("Hello World")
TestD() # Start from here
And the output is
TestD
TestC None
TestA None
TestB Hello World
I would expect to have :
TestD
TestB Hello World
TestA Hello World
TestC Hello World
What's wrong in my code or my understanding?
If I remove super on TestA, TestB, TestC and I call 3 times super like below, I have the expected output. (But I don't want to call three times super)
class TestD(TestB, TestA, TestC):
def __init__(self):
print 'TestD'
super(TestD, self).__init__("Hello World")
super(TestD, self).__init__("Hello World")
super(TestD, self).__init__("Hello World")
Thank you in advance.