[Python-Dev] No __bases__ in dir()

Guido van Rossum guido at python.org
Sat Mar 15 17:20:59 CET 2008


This is because dir() special-cases classes, isn't it?

On Sat, Mar 15, 2008 at 11:09 AM, Christian Heimes <lists at cheimes.de> wrote:
> > Why __bases__ does not appear in dir()?
>  >
>  > Is there a good reason for this or should I file a bug?
>
>  __bases__ and several other methods like mro and __subclasses__ are
>  defined on the meta class. dir() doesn't list the attributes of the meta
>  class of a class.
>
>
>  >>> class C(object):
>  ...     pass
>  ...
>  >>> dir(type(C))
>  ['__base__', '__bases__', '__basicsize__', '__call__', '__class__',
>  '__cmp__', '__delattr__', '__dict__', '__dictoffset__', '__doc__',
>  '__flags__', '__getattribute__', '__hash__', '__init__', '__itemsize__',
>  '__module__', '__mro__', '__name__', '__new__', '__reduce__',
>  '__reduce_ex__', '__repr__', '__setattr__', '__str__', '__subclasses__',
>  '__weakrefoffset__', 'mro']
>
>  Christian
>
>
>
>  _______________________________________________
>  Python-Dev mailing list
>  Python-Dev at python.org
>  http://mail.python.org/mailman/listinfo/python-dev
>  Unsubscribe: http://mail.python.org/mailman/options/python-dev/guido%40python.org
>



-- 
--Guido van Rossum (home page: http://www.python.org/~guido/)


More information about the Python-Dev mailing list