delattr()+dir() problem in 2.2b1

Skip Montanaro skip at pobox.com
Fri Nov 2 15:24:16 EST 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 pobox.com)
http://www.mojam.com/
http://www.musi-cal.com/




More information about the Python-list mailing list