This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author amaury.forgeotdarc
Recipients Arfrever, amaury.forgeotdarc, benjamin.peterson, docs@python, eryksun, georg.brandl, pitrou, techdragon
Date 2014-11-04.17:43:40
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1415123020.94.0.140197876832.issue22790@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2014-11-04 17:43:40amaury.forgeotdarcsetrecipients: + amaury.forgeotdarc, georg.brandl, pitrou, benjamin.peterson, Arfrever, docs@python, eryksun, techdragon
2014-11-04 17:43:40amaury.forgeotdarcsetmessageid: <1415123020.94.0.140197876832.issue22790@psf.upfronthosting.co.za>
2014-11-04 17:43:40amaury.forgeotdarclinkissue22790 messages
2014-11-04 17:43:40amaury.forgeotdarccreate