Finding a class' superclasses

Michael Hudson mwh at python.net
Mon Aug 23 20:18:04 CEST 2004


Hallvard B Furuseth <h.b.furuseth at usit.uio.no> writes:

> How do I find a class' immediate superclasses?
> That is, given
>   class A:       pass
>   class B(A):    pass
>   class C(A):    pass
>   class D(B, C): pass
> I want a function foo where foo(D) or foo(D()) returns (B, C).
> (Well, the order of the classes is not important.)

D.__bases__?

Cheers,
mwh

-- 
  ... Windows proponents tell you that it will solve things that
  your Unix system people keep telling you are hard.  The Unix 
  people are right: they are hard, and Windows does not solve 
  them, ...                            -- Tim Bradshaw, comp.lang.lisp



More information about the Python-list mailing list