[issue31503] Enhance dir(module) to be informed by __all__ by updating module.__dir__

2018-12-21 Thread Cheryl Sabella
Cheryl Sabella added the comment: The OP commented on the PR that a feature close enough to the original request was being implemented in PEP562, so I will close this issue with that one as a superseder. -- nosy: +cheryl.sabella resolution: -> duplicate stage: -> resolved status:

[issue31503] Enhance dir(module) to be informed by __all__ by updating module.__dir__

2017-09-18 Thread R. David Murray
Changes by R. David Murray : -- nosy: +r.david.murray ___ Python tracker ___ ___

[issue31503] Enhance dir(module) to be informed by __all__ by updating module.__dir__

2017-09-18 Thread Nick Coghlan
Nick Coghlan added the comment: Yes, that's one of the goals of the feature: to allow module authors to decide if they want tab completion for all attributes, or just the public API. -- ___ Python tracker

[issue31503] Enhance dir(module) to be informed by __all__ by updating module.__dir__

2017-09-18 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: This would break tab completion of names not included in __all__. -- nosy: +serhiy.storchaka ___ Python tracker ___

[issue31503] Enhance dir(module) to be informed by __all__ by updating module.__dir__

2017-09-17 Thread Nick Coghlan
Nick Coghlan added the comment: As far the implementation goes, since the `__dir__` overload support in the `dir()` builtin ignores instance dictionaries, this could be implemented in module.__dir__ (or object.__dir__) rather than directly in the builtin. Alternatively, it could use a

[issue31503] Enhance dir(module) to be informed by __all__ by updating module.__dir__

2017-09-17 Thread Nick Coghlan
Nick Coghlan added the comment: While I agree changing the default would be risky from a compatibility perspective, I do think it would be helpful to offer a straightforward way to filter out transitive imports and other non-public implementation details from the result of `dir(module)`, and

[issue31503] Enhance dir(module) to be informed by __all__ by updating module.__dir__

2017-09-17 Thread Terry J. Reedy
Terry J. Reedy added the comment: Guido on python-ideas: I ave to agree with the other committers who already spoke up. Me: I use dir to see the complete list now presently presented. The presence or absence of __file__ indicates coded on Python or not. IDLE module completion start with

[issue31503] Enhance dir(module) to be informed by __all__ by updating module.__dir__

2017-09-17 Thread Raymond Hettinger
Raymond Hettinger added the comment: I think change this would be risky and could break code that uses dir() to actually know what is in a module. IIRC, this was discussed when __all__ was introduced. I believe it was decided that __all__ would affect from-imports and help() but not dir().

[issue31503] Enhance dir(module) to be informed by __all__ by updating module.__dir__

2017-09-17 Thread Cody Piersall
New submission from Cody Piersall: If a some_module defines __all__, dir(some_module) should only return what is in __all__. This is already a mechanism that Python provides to specify module-level APIs. Currently, dir(some_module) returns some_module.__dict__.keys(). The concern with this