On 18 Sep 2006 12:40:00 -0700, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > I think I read a suggestion somewhere to wrap the code where a Python > script starts in a main() function, so one has > > def main(): > print "hi" > > main() > > instead of > > print "hi" > > What are the advantages of doing this?
It is useful both importating scripts without running them, for debugging or reusing parts of them later, and also for adding small test scripts to modules to allow them to be run for testing purposes. -- http://mail.python.org/mailman/listinfo/python-list