1 class A: 2 def __getattr__(self, name): 3 print("You use getattr.") 4 def __setattr__(self, name, value): 5 print("You use setattr.") 6 self.__dict__[name] = value
1 class A: 2 def __getattr__(self, name): 3 print("You use getattr.") 4 def __setattr__(self, name, value): 5 print("You use setattr.") 6 self.__dict__[name] = value