[Python-3000] The main module in Py3k

Greg Ewing greg.ewing at canterbury.ac.nz
Wed Jul 5 03:19:38 CEST 2006


Nick Coghlan wrote:

> The existing "if __name__ == '__main__' idiom would be replaced by a simple 
> "if __main__:"

That sounds good.

> A new attribute in the sys module "main" would always reference the main 
> module of the application. The main module would also be stored in sys.modules 
> under the name "sys.main",

Why not just __main__ as the alias name? Is there any need
to invent a new name for this?

> Files that are executed directly would have their __name__ attribute set to 
> "<main>".

Again, why not leave it as "__main__" in this case? And if
it must change, does it really have to be something that's
not a valid identifier and/or doesn't correspond to anything
in sys.modules?

--
Greg



More information about the Python-3000 mailing list