Next / Previous / Contents / Shipman's homepage

4.10. 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 litlxml is the main script. Python sets global variable __name__ to the string '__main__' for the outermost script.

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

if  __name__ == '__main__':
    main()