On 7/13/07, Greg Ewing <[EMAIL PROTECTED]> 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. Andy _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com