What's the Zen of Python?

What Exactly Is the Zen of Python?

by Bartosz Zaczyński Updated Reading time estimate 23m basics python

The Zen of Python is a collection of 19 aphorisms that capture the guiding principles behind Python’s design. You can display them anytime by running import this in a Python REPL. Tim Peters wrote them in 1999 as a joke, but they became an iconic part of Python culture that was even formalized as PEP 20.

By the end of this tutorial, you’ll understand:

  • The Zen of Python is a humorous poem of 19 aphorisms describing Python’s design philosophy
  • Running import this in a Python interpreter displays the complete text of the Zen of Python
  • Tim Peters wrote the Zen of Python in 1999 as a tongue-in-cheek comment on a mailing list
  • The aphorisms are guidelines, not strict rules, and some intentionally contradict each other
  • The principles promote readability, simplicity, and explicitness while acknowledging that practicality matters