28 Mar
2006
28 Mar
'06
10:47 p.m.
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.