Realcodeart.com

Zen of Python

Twenty rules for writing Python, hidden in a file that plays a trick.

Tim Peters wrote the Zen of Python in PEP 20. The language hides the text in this.py behind a ROT13 puzzle.

Tim Peters, PEP 20. File this.py.

License on this page

License notice

Copyright (c) 2001 Python Software Foundation; All Rights Reserved. PSF License Version 2.

Tim Peters wrote the Zen of Python as PEP 20, twenty aphorisms that quietly shape how the language is used. CPython hides the text inside the file this.py behind a ROT13 puzzle, so that import this prints it.

ROT13 slides each letter thirteen places, and running it twice gives the text back. The bars are that file: a long green run is the hidden string, and the short lines around it are the decoder. Not one rule among them is enforced by the compiler.

History of Zen of Python

Gift guide: A birthday gift for a programmer

Next piece: jQuery

Related pieces