why a main() function?

Steve Holden steve at holdenweb.com
Mon Sep 18 23:01:47 CEST 2006


beliavsky at aol.com 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?
> 
Guido van Rossum himself can tell you:

   http://www.artima.com/forums/flat.jsp?forum=106&thread=4829

regards
  Steve
-- 
Steve Holden       +44 150 684 7255  +1 800 494 3119
Holden Web LLC/Ltd          http://www.holdenweb.com
Skype: holdenweb       http://holdenweb.blogspot.com
Recent Ramblings     http://del.icio.us/steve.holden




More information about the Python-list mailing list