crossplatform py2exe - would it be useful?

Alex Martelli aleax at aleax.it
Thu Aug 7 15:19:40 CEST 2003


Thomas Heller wrote:
   ...
>>> myscript -c "import sys; sys.path.insert(0, sys.executable); import foo"
   ...
>> Sounds like a good idea to me, if a sensible name is chosen for the
>> "main module" (I propose 'main':-).
> 
> My choice would have been __main__ :-) Is it really the correct way to
> 'import __main__' instead of 'running' it?

Well, most main scripts ARE coded with the "if __name__=='__main__':"
convention, after all, so an "import __main__" can be seen as a way
to just piggyback on that existing convention rather than inventing a
new one in addition.  So, I concede it's better than "import main".


Alex





More information about the Python-list mailing list