In Python, a lot of the “special” attributes of objects are stored in the __dict__ dictionary, like __doc__, __module__ (from what I could see in my experiments).
However some are not, like __class__. My question is exactly which attributes are not stored in __dict__ (is that even documented somewhere?), and why are they not?
It depends what
__dict__you are talking about. Python has a method resolution order that (ignoring the fun of multiple inheritance) works by checking the instance, then the class, then the parent class, then it’s parent class, etc…So
__class__, for instance, is inobject.__dict__– which is why it’s defined for all classes as they inherit fromobject.