PEP

In Python, PEP stands for Python enhancement proposal and refers to a design document that provides information to the Python community or proposes changes to Python itself.

PEPs are intended to describe new features or processes for Python, provide technical specifications, or even document the environment or development process. They play a critical role in Python’s development by acting as the primary mechanism for proposing major new features, collecting community input on issues, and documenting the design decisions that have gone into Python.

PEPs ensure that Python evolves coherently and organizedly, with input from the community and oversight by the Python Steering Council.

Example

Here’s an example that displays the content of PEP 20 – The Zen of Python:

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.
Special cases aren't special enough to break the rules.
Although practicality beats purity.
Errors should never pass silently.
Unless explicitly silenced.
In the face of ambiguity, refuse the temptation to guess.
There should be one-- and preferably only one --obvious way to do it.
Although that way may not be obvious at first unless you're Dutch.
Now is better than never.
Although never is often better than *right* now.
If the implementation is hard to explain, it's a bad idea.
If the implementation is easy to explain, it may be a good idea.
Namespaces are one honking great idea -- let's do more of those!

This list of design principles and philosophies is helpful in understanding and using the Python language.

Tutorial

How to Write Beautiful Python Code With PEP 8

Learn how to write high-quality, readable code by using the Python style guidelines laid out in PEP 8. Following these guidelines helps you make a great impression when sharing your work with potential employers and collaborators.

intermediate best-practices

For additional information on related topics, take a look at the following resources:


By Leodanis Pozo Ramos • Updated Dec. 20, 2024 • Reviewed by Dan Bader