I noticed many built-in classes do not have a __dict__
and even classes in modules such as numpy
do not have __dict__
defined as they had been defined in C.
I want to define __getattr__
, but I'm worried about a recursive loop creeping into the (long) code of one of my class (e.g. see the second reply Understanding the difference between __getattr__ and __getattribute__).
Is there a way I can disable creation of __dict__
? Do I need to use __slots__
?