我有以下实现多重继承的代码。我希望调用super(base2,self).__init__()
打印--> "Printing from base2".
但是程序什么也没打印;它也不会引发错误。
class base1:
def __init__(self):
print("printing from base1")
def method(self,val):
print("From method of base1", val)
class base2:
def __init__(self):
print("printing from base2")
def method(self,val):
print("From method of base2", val)
class child(base1, base2):
def __init__(self):
super(base2,self).__init__() #is not working as expected
x = child()