[issue19002] ``dir`` function does not work correctly with classes.
Ethan Furman
report at bugs.python.org
Wed Sep 11 15:36:11 CEST 2013
Ethan Furman added the comment:
It's going to take more than "I think that that's not true," to get a change made.
>From http://docs.python.org/2/library/functions.html#dir :
>
> Because dir() is supplied primarily as a convenience for use at an
> interactive prompt, it tries to supply an interesting set of names
> more than it tries to supply a rigorously or consistently defined
> set of names [...] .
Currently, `dir(cls)` returns information that tells us how instances of that class will behave. Because metaclass methods have no direct effect on instance behavior, having dir return metaclass methods and attributes would be confusing.
If you want to know how a class is going to behave you need to `dir(cls.__class__)`.
----------
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue19002>
_______________________________________
More information about the Python-bugs-list
mailing list