On 12 July 2016 at 19:26, Victor Stinner <victor.stinner at gmail.com> wrote: > "PEP 499 -- python -m foo should bind sys.modules['foo'] in addition > to sys.modules['__main__']" > https://www.python.org/dev/peps/pep-0499/ > => draft I'm a little wary of this one, as we just received a bug report regarding some subtleties of the 3.5.2 change that separated the "import the parent module" step from the "execute the requested main module" step when using the -m switch with a submodule: http://bugs.python.org/issue27487 The problem there relates to some odd behaviour that can arise when importing the parent module implicitly imports the submodule that has been requested to be run as __main__. While PEP 499 would eliminate the dual import problem when the import happens *after* __main__ starts execution, it wouldn't prevent it when the import happens *first* (as in the case of it happening as a side-effect of importing the parent module), making the consequences even more surprising and harder to debug. Cheers, Nick. -- Nick Coghlan | ncoghlan at gmail.com | Brisbane, Australia
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4