[Python-ideas] Module aliases and/or "real names"
ncoghlan at gmail.com
Wed Jan 5 03:00:05 CET 2011
On Wed, Jan 5, 2011 at 11:48 AM, Ron Adam <rrr at ronadam.com> wrote:
> (This is probably something that was suggested more than a few times
> Would it help if global name space acquired a __main__ name? Then the
> standard if line becomes only a slightly different "if __name__ == __main__:
> main()". I think that would make more sense to beginners also and it is a
> bit less magical.
> For now, both ways could work, __main__ would be "__main__" or None, but
> down the road, (long enough to be sure everyone knows to drop the quotes),
> both __main__ and __name__ could be switched to the actual module name so
> that __name__ and __module__ attributes would always be correct.
If we decided to actually change the way the main module was executed,
the most likely result would be to resurrect PEP 299. Changing that
particular idiom is probably a Py4k scale of change though :P
Nick Coghlan | ncoghlan at gmail.com | Brisbane, Australia
More information about the Python-ideas