On 03/04/2011 09:30 AM, Nick Coghlan wrote: > Fixing dual imports of the main module > -------------------------------------- > > Two simple changes are proposed to fix this problem: > > 1. In ``runpy``, modify the implementation of the ``-m`` switch handling to > install the specified module in ``sys.modules`` under both its real name > and the name ``__main__``. (Currently it is only installed as the latter) > 2. When directly executing a module, install it in ``sys.modules`` under > ``os.path.splitext(os.path.basename(__file__))[0]`` as well as under > ``__main__``. > > With the main module also stored under its "real" name, imports will pick it > up from the ``sys.modules`` cache rather than reimporting it under a new name. > Fixing direct execution inside packages +1 on both of these. I don't see any major problems with these. Any minor issues can be worked out. I suggest separating these two items out into their own PEP, and doing them first. Cheers, Ron
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