[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?


I'm sure there are other reasons, but for me the most important is that
you can import your code into the interpreter and poke at it from there
without executing the script.  Also, of course, you can re-use your
code as a module in another program.

-Ben

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to