Author codypiersall
Recipients codypiersall
Date 2017-09-18.02:20:35
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1505701236.05.0.735759478714.issue31503@psf.upfronthosting.co.za>
In-reply-to
Content
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 enhancement is backwards compatibility.  It is conceivable that some library's code would be broken with the different return value of dir(some_module).  However, it seems unlikely that any code, other than tests, depends on the current behavior of dir(some_module).

If __all__ is not defined in some_module, the old behavior is preserved.
History
Date User Action Args
2017-09-18 02:20:36codypiersallsetrecipients: + codypiersall
2017-09-18 02:20:36codypiersallsetmessageid: <1505701236.05.0.735759478714.issue31503@psf.upfronthosting.co.za>
2017-09-18 02:20:36codypiersalllinkissue31503 messages
2017-09-18 02:20:35codypiersallcreate