[Tutor] Which is better Practice and why
chigga101 at gmail.com
Mon Oct 22 13:45:16 CEST 2012
In many of the tutorial examples ive come across, the main code's program
is never at the top level, but always in a function of some sort. i
understand why but, there is always a different way used to access the main
code, i want to know which is the best.
they call the main program by simply calling the main function. I've also
seen a more complcated:
if __name__ == '__main__':
the 2nd one usually includes a lot more code then i showed. can you please
tell me why different methods are used to access the main code? is it just
preference or is one way actually better coding practice?
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Tutor