Where this idea comes from
Python and the Zen of Python
Guido van Rossum started writing Python over the Christmas holiday of 1989, at the CWI research institute in Amsterdam, and first shared it in February 1991. He named it after the BBC comedy show Monty Python’s Flying Circus, not the snake. In 1999 Tim Peters, an early Python programmer, posted a short poem of rules for Python code to the Python mailing list; in 2004 it became PEP 20, The Zen of Python.
One thing to hold: Type import this into Python and it prints the Zen: nineteen short lines about how code should read.
Why it matters: Most of the Zen is about the person reading the code, not the computer running it. Code is read many more times than it is written, so a program a stranger can follow line by line, the way you trace one here, is worth more than a clever one nobody can.
What we don’t know: Peters wrote that there are twenty rules but wrote down only nineteen. The twentieth was left for van Rossum, and nobody has filled it in.
In the Zen’s own words:
Readability counts.
Which program you traced was easiest to follow, and what made it easy?Explicit is better than implicit.
Where would a clearer variable name have told you what it holds?Errors should never pass silently.
When a program goes wrong, would you rather it stop with a message or print a wrong answer?
Dates:
- 1989 Van Rossum starts writing Python over the Christmas holiday.
- 1991 Python 0.9.0 is shared publicly.
- 1999 Tim Peters posts the Zen to the Python mailing list.
- 2004 The Zen becomes PEP 20.