[Python-Dev] What about PEP 299?
Phillip J. Eby
pje at telecommunity.com
Tue Mar 28 21:47:07 CEST 2006
At 09:22 PM 3/28/2006 +0200, Georg Brandl wrote:
>Hi,
>
>since I found myself writing "if __name__ == '__main__'"
>often these days, I wondered whether PEP 299 could be pronounced
>upon. I'm not proposing putting it into 2.5, but it should be
>relatively small a change.
A couple of issues that the PEP doesn't address:
* How can you write code that runs in multiple Python versions with
this? If you use the current idiom to invoke __main__, it's going to get
invoked twice.
* A module that imports __main__ (using "import __main__") is going to get
a TypeError unless the implementation checks that __main__ is not in fact
the __main__ module.
More information about the Python-Dev
mailing list