Next / Previous / Contents / Shipman's homepage

4.13. Epilogue

Rather than placing the main at the end of the script, we defined it above (Section 4.6, “The main program”) as a function main() so that the code can be presented in top-down order.

The lines below cause main() to be called, assuming that litdocbook5 is the main script. Python sets global variable __name__ to the string '__main__' for the outermost script.

litdocbook5
# - - - - -   E p i l o g u e

if  __name__ == '__main__':
    main()