[Python-Dev] No __bases__ in dir()
Christian Heimes
lists at cheimes.de
Sat Mar 15 17:09:32 CET 2008
> 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
More information about the Python-Dev
mailing list