[Python-3000] The main module in Py3k (original) (raw)
Greg Ewing greg.ewing at canterbury.ac.nz
Wed Jul 5 03:19:38 CEST 2006
- Previous message: [Python-3000] The main module in Py3k
- Next message: [Python-3000] [Python-Dev] xrange vs. int.__getslice__
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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 "
".
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
- Previous message: [Python-3000] The main module in Py3k
- Next message: [Python-3000] [Python-Dev] xrange vs. int.__getslice__
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]