Next / Previous / Contents / TCC Help System / NM Tech homepage

4.12. Epilogue

Rather than placing the main at the end of the script, we defined it above (Section 4.5, “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 litsource is the main script. Python sets global variable __name__ to the string '__main__' for the outermost script.

litsource
# - - - - -   e p i l o g u e   - - - - -

if  __name__ == '__main__':
    main()