next up previous contents index
Next: Program Manuals Up: Writing Python Scripts Previous: Command-Line Argument Parsing   Contents   Index

Code Modularity

It is recommended that all program code be separated into 1 or more functions rather directly written at the base level. This allows programs to be run either individually or imported as modules into other programs that wish to use their functionality.

Normally the base level of the program only includes

if __name__=="__main__":
    main()
where main() is the function that actually begins completing the program's work.



2013-06-11