1# test multiple inheritance of user classes 2 3class A: 4 def __init__(self, x): 5 print('A init', x) 6 self.x = x 7 8 def f(self): 9 print(self.x) 10 11 def f2(self): 12 print(self.x) 13 14class B: 15 def __init__(self, x): 16 print('B init', x) 17 self.x = x 18 19 def f(self): 20 print(self.x) 21 22 def f3(self): 23 print(self.x) 24 25 26class Sub(A, B): 27 def __init__(self): 28 A.__init__(self, 1) 29 B.__init__(self, 2) 30 print('Sub init') 31 32 def g(self): 33 print(self.x) 34 35print(issubclass(Sub, A)) 36print(issubclass(Sub, B)) 37 38o = Sub() 39print(o.x) 40o.f() 41o.f2() 42o.f3() 43