instance introspection and __slots__

Rod Mancisidor mancisidor at computer.org
Tue Oct 15 15:09:14 EDT 2002


I used to be able to find all the direct attributes of an instance by using
__dict__.  With python 2.2 this is no longer possible since __dict__ may not
even exist and when it does it will not include the attributes in the union
of all the __slots__ in the MRO of the instance.  dir() doesn't do it either
since it returns attributes that don't belong directly to the instance.  Is
there a primitive in Python 2.2 that will return something similar to the
old __dict__ or __dict__.keys()?

Thanks





More information about the Python-list mailing list