Superclasses

Gerrit Holl gerrit.holl at pobox.com
Fri Feb 18 09:51:29 EST 2000


Joshua C. Marshall wrote on 950805378:
> On Thu, 17 Feb 2000, Fredrik Lundh wrote:
> 
> > Joshua C. Marshall <jayantha at ccs.neu.edu> wrote:
> > > Given a class object, is there a way to get at its superclass object?
> > 
> > the thing you're looking for is "__bases__"
> 
> Thanks, that's what I needed.  Incidently, where is "__bases__" defined?  
> If "T" is a class object, doing a "dir(T)" doesn't show "__bases__" as a
> field.
> 
> Sorry if this is a double-post.  Doesn't seem my last one went through.

>>> class Foo:
...     pass
...
>>> class Bar:
...     pass
...
>>> class Fubar(Foo, Bar):
...     pass
...
>>> print Fubar.__bases__
(<class __main__.Foo at 80fbf90>, <class __main__.Bar at 80fce18>)

regards,
Gerrit.

-- 
cat: /home/gerrit/.signature: No such quote or joke




More information about the Python-list mailing list