[Python-Dev] Add a -z interpreter flag to execute a zip file
andychup at gmail.com
Sat Jul 14 06:38:12 CEST 2007
On 7/13/07, Greg Ewing <greg.ewing at canterbury.ac.nz> wrote:
> Andy C wrote:
> > What does "if __name__ == '__main__" mean in
> > __main__.py? : ) If someone tries does import __main__ from another
> > module in the program, won't that result in an infinite loop?
> Is there a reason not to use __init__.py for this?
Well, you might have multiple executable .py files in the same source
tree. So then you would want to build multiple .pyz files, each of
which has a different __zipmain__.
I think of __zipmain__ as part of the format of the .pyz file, not
part of the source tree. In particular, it specifies what
module/function to run in the zipped source tree (and I imagine it
will be adapted for other uses). In this model you're separating your
development tree and the thing you deploy, which is not always the
case in Python.
More information about the Python-Dev