1class A: 2 def __init__(self, x): 3 print('A init', x) 4 self.x = x 5 6 def f(self): 7 print(self.x, self.y) 8 9class B(A): 10 def __init__(self, x, y): 11 A.__init__(self, x) 12 print('B init', x, y) 13 self.y = y 14 15 def g(self): 16 print(self.x, self.y) 17 18A(1) 19b = B(1, 2) 20b.f() 21b.g() 22