Amaury Forgeot d'Arc added the comment:

So, dir(C) contains '__mro__', but not 'mro'?

I'm -1 on the change.
>From https://docs.python.org/3.4/library/functions.html#dir :
"""
Note 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, and its 
detailed behavior may change across releases. For example, metaclass attributes 
are not in the result list when the argument is a class.
"""

dir(sys) does not list its __str__ method, even if sys.__str__() works, because 
returning only the explicit content of the module is more interesting to the 
user.

Likewise, the implementation of dir(__class__) returns the methods and 
attributes of *instances* because [someone decided that] it's the most relevant 
info for the user.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue22790>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to