class A: def __init__(self): self.x = 1 class B(A): def __init__(self): super().__init__() self.y = 2 b = B() print(b.x, b.y)
1 2
报错
None 2
1 None