What is the output of the following code ?
class A: x = 10 def __getattr__(self, item): print("__getattr__ is called") a = A() a.Y
AttributeError: 'A' object has no attribute 'Y'
__getattr__ is called
10
None
__getattr__() method is invoked for each undefined attribute
As we are trying to fetch attribute "Y which is not available in instance scope. it invokes __getattr__() method
Comment here: