Skip to content
derpx06Notes on systems, models & learning
1. Foundations · lesson 2 of 17 · 1 min · January 1, 2024

The Zen of Python

Understanding the philosophy of Python.

Python has a somewhat Zen description of its design principles, which you can also find inside the Python interpreter itself by typing import this.

zen.py
import this
# Output:
# Beautiful is better than ugly.
# Explicit is better than implicit.
# Simple is better than complex.
# ...
# There should be one-- and preferably only one --obvious way to do it.

One of the most discussed of these principles is: There should be one—and preferably only one—obvious way to do it.

Code written in accordance with this "obvious" way (which may not be obvious at all to a newcomer) is often described as "Pythonic". Although this is not a book about Python, we will occasionally contrast Pythonic and non-Pythonic ways of accomplishing the same things, and we will generally favor Pythonic solutions to our problems.