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.


main()
     main's code

#top level
main()

they call the main program by simply calling the main function. I've also
seen a more complcated:

if __name__ == '__main__':
    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?
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to