How to list the superclassesof an object

Fernando Rodriguez frr at easyjob.net
Wed Nov 5 11:33:44 EST 2003


On Wed, 05 Nov 2003 16:17:11 GMT, Alex Martelli <aleax at aleax.it> wrote:


>>>> x.__class__.__bases__
>(<class __main__.A at 0x402db41c>, <class __main__.B at 0x402db44c>)

I didn't know the existence of the __bases__ attribute, and it doesn't show
with dir().  How can I get a list of ALL the attributes of an object? 

I thought that dir()  listed every attribute.... O:-)

>
>You may need a recursive walk up the (DA) graph if you also want
>bases of bases, etc, among 'superclasses'; alternatively, but
>ONLY for newstyle classes (recommended anyway for many reasons):

I haven't used python in a while and all my classes are 'old style'. I'd like
to get up to date. Where can I find info about the differences / advantages of
these new classes?  Is it safe to convert all my previous classes to new ones,
and how can I do it? O:-)

TIA




More information about the Python-list mailing list