Message230646
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. |
|
Date |
User |
Action |
Args |
2014-11-04 17:43:40 | amaury.forgeotdarc | set | recipients:
+ amaury.forgeotdarc, georg.brandl, pitrou, benjamin.peterson, Arfrever, docs@python, eryksun, techdragon |
2014-11-04 17:43:40 | amaury.forgeotdarc | set | messageid: <1415123020.94.0.140197876832.issue22790@psf.upfronthosting.co.za> |
2014-11-04 17:43:40 | amaury.forgeotdarc | link | issue22790 messages |
2014-11-04 17:43:40 | amaury.forgeotdarc | create | |
|