The Zen of Python is a collection of 19 software principles written in a poem that influences the design of Python Programming Language. It was published on the Python mailing list in June 1999 by Tim Peters. *
The Zen of Python is included as an easter egg in the Python REPL. You can read it by typing import this
in our REPL, to learn a little more about the principles and philosophy behind Python.
>>> import this
The Zen of Python, by Tim Peters
Beautiful is better than ugly.
Explicit is better than implicit.
Simple is better than complex.
Complex is better than complicated.
Flat is better than nested.
Sparse is better than dense.
Readability counts.
...
Generally, Python programmers prefer to be explicit and write simple, understandable, and maintainable code instead of ego flexing and writing unnecessarily complex code.
Make your code easy to read. Avoid single character variable names. Call your functions with named parameters where applicable. Use good variable names.
Python encourages you to write simple, readable code by following a style-guide called PEP8.
PEP8 is a Python coding standard, that sets guidelines for how our Python code should look and be formatted.
Tools called linters will identify when your code doesn’t meet PEP8 standards. The warnings that linters give aren’t syntax errors. Your code will still run, but it won’t meet Python code style standards.
To see another Python easter egg, type the following into your REPL: from __future__ import braces
>>> from __future__ import braces
File "<stdin>", line 1
SyntaxError: not a chance
My favorite Easter Egg? Type import antigravity
into the REPL.