Jul-25-2018, 11:03 AM
![[Image: 6cZhJ.png]](https://i.stack.imgur.com/6cZhJ.png)
![[Image: YjF2i.png]](https://i.stack.imgur.com/YjF2i.png)
class A:
x = 1
def __getattr__(self,name):
print("__getattr__ of A")
def __getattribute__(self,name):
print("__getattribute__ of A")
return super().__getattribute__(name)
class B(A):
x = 2
def __getattr__(self,name):
print("__getattr__ of B")
def __getattribute__(self,name):
print("__getattribute__ of B")
a = A()
return a.__getattribute__(name)
b = B()
print(b.x)I want to ask Why A will be printed twice.I have tried debug ,but after that I am more puzzled.Thanks.
