The module __main__ is somewhat special. It's there from the very beginning (so far as I can tell). $ python3 -c 'import __main__; print(__main__)' <module '__main__' (built-in)>
And without importing __main__. $ python3 -c 'import sys; print(sys.modules["__main__"])' <module '__main__' (built-in)> In light of this, it seems to me that the technical implementation of the proposal amounts to 1. When creating a new module object, set __main__ = False 2. When initializing the built-in __main__ module, set __main__ = True I don't see a technical problem in the implementation of this idea. (I suspect the same rules will also work for C-coded modules.) Whether a good idea or not is another question. -- Jonathan
_______________________________________________ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@python.org https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://mail.python.org/archives/list/python-ideas@python.org/message/UF6AM5DMEQJZQRNX3O3DMWRZOGIKKMCB/ Code of Conduct: http://python.org/psf/codeofconduct/