I know accessing the attributes of Foo through an instance will call the __getattribute__() method, but what if I access this attribute directly through the class? If a function is called, I want to set a breakpoint in it so that the breakpoint can be triggered when accessing this property through a class in my project.
I have tried to set breakpoint in magic method __getattribute__(), but nothing hapened.
class Foo:
age = 18
print(Foo.age) # I am curious what method is called
__dict__isn't a method; the instance dict is directly available with this name, you don't call it.__dict__is a descriptor which provides the instance dict.__dict__is also a magic method.