Learn/Python Overview/Part 1 · 1. Foundations
Lesson 2 of 17
SyllabusPython Overview · Part 1

The Zen of Python

Understanding the philosophy of Python.

Course outline & contents
Python Overview
The ToolboxThe Zen of PythonStructural Basics
On this page

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.

Track your progressSign in and your progress follows you across devices.
Sign in to track progress Next lesson
← Previous lessonThe ToolboxNext lesson →Structural Basics