delattr()+dir() problem in 2.2b1

Skip Montanaro skip at
Fri Nov 2 21:24:16 CET 2001

    Chuck> So dir() is now returning attributes that the object doesn't
    Chuck> really have, but inherits. Is that intentional?

Yup.  In the common case (executing dir() at the interpreter prompt), this
is more useful than the old behavior.  

    Chuck> Is there another function that I should be using to get the data
    Chuck> attributes of a particular instance and no more?

I don't think so.  I think you'll either have to catch the exception or
rummage around in the object's __dict__.

Skip Montanaro (skip at

More information about the Python-list mailing list