Source

Python 3 Patterns & Idioms / docs / CanonicalScript.rst

Full commit

A Canonical Form for Command-Line Programs

Creating Python programs for command-line use involves a certain amount of repetitious coding, which can often be left off or forgotten. Here is a form which includes everything.

Note that if you are using Windows, you can add Python programs to your "File New" menu and automatically include the above text in the new file. This article shows you how. Other operating systems have their own automation features.