<div>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.</div>
<div> </div><div> </div><div>main()</div><div>     main's code</div><div> </div><div>#top level</div><div>main()</div><div> </div><div>they call the main program by simply calling the main function. I've also seen a more complcated:</div>
<div> </div><div>if __name__ == '__main__':<br>    main()</div><div> </div><div>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?</div>