http://home.comcast.net/~faulkner612/programming/python/mainer.py turns if __name__ == '__main__': sys.exit(main(sys.argv)) into import mainer
[EMAIL PROTECTED] wrote: > I don't like much the syntax of: > if __name__ == '__main__': > > Some time ago I have read this PEP: > http://www.python.org/dev/peps/pep-0299/ > > And why it was refused: > http://mail.python.org/pipermail/python-dev/2006-March/062955.html > > I think the name of the standard main function may be just main(), so > there isn't the problem with the import (and *maybe* the problem with > multiple Python versions can be ignored with Python 3.0). > > If a module contains the main(), the main() is executed when the module > is run alone. Otherwise you can import the module, with the main() > function managed as a normal function. > > Bye, > bearophile -- http://mail.python.org/mailman/listinfo/python-list