Metaclass hierarchy? (was Re: Superclasses)

Joshua C. Marshall jayantha at ccs.neu.edu
Thu Feb 17 16:43:36 EST 2000


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__"

Yup, thanks.  Though this prods another question out of me.  If "T" is a
class object, "dir(T)" does not show "__bases__" as a field.  What is the
lookup rule for getting fields from class objects?  Is it similar to
getting fields from instances (where the interpreter goes up the class
hierarchy until it finds what you're looking for)?  If so, what hierarchy
is being examined?




More information about the Python-list mailing list