Maybe you’re new to Python and have no idea what PEP is. Or maybe you’re a Python buff, have seen a few PEPs, and have no idea what’s behind it. That’s right. This article will give you a systematic introduction to PEP and help you understand PEP better.

At present, there are numerous kinds of tutorials in China. Although PEP is mentioned more or less, there are many general ones and limited to one PEP, and there are not many articles that can introduce PEP in detail and comprehensively.

The purpose of this article is to provide as comprehensive an introduction as possible to what PEP is and why you should read IT, as well as a list of some PEPs that I think are must-read, and finally, to collect some Chinese translations of PEPs, in the hope of contributing to the localization of Python learning materials.

What is PEP?

The full name of PEP is Python Enhancement Proposals, which can be translated into Proposals or Proposals, so the common translations are Python Enhancement Proposals or Python improvement Proposals.

I personally prefer the former translation because it is more apt. Python core developers mainly discuss issues, proposals, plans, etc., through mailing lists. PEP is usually a formal document that summarizes information from various sources and is reviewed and approved by some core developers. It serves as a public disclosure, so I think it is more appropriate to translate it as “proposals”.

The PEP’s website is: https://www.python.org/dev/peps/, this is the address of the PEP 0. Other PEP address number is the stitching at the back, for example, https://www.python.org/dev/peps/pep-0020/ is the PEP 20 links, and so on.

The first PEP was born in 2000 and now comes of age at 18. So far, it has 478 “brothers and sisters.”

Peps are officially divided into three categories:

I – Informational PEP

P – Process PEP

S – Standards Track PEP

Its meanings are as follows:

Informational: This type of PEP provides information, including informational information, instructional information, and so on. Examples include PEP 20 (The Zen of Python), AND PEP 404 (Python 2.8 UN-release Schedule, which declares that there will be no Python2.8 version).

Process classes: This type of PEP is mostly peripheral information outside of Python itself. Examples include PEP 1 (PEP Purpose and Guidelines), and PEP 347 (Migrating the Python CVS to Subversion).

Standard class: This class of PEPs mainly describes new Python features and new practices. It is the most numerous proposal.

Each PEP starts out as a Draft, then goes through a process, and thus has a different state. Here’s a flow chart:

A — Accepted (Standards Track only) or Active proposal Accepted (Standards Track only) or valid proposal

D – Deferred Proposal

F – Final proposal

P — Provisional proposal

R — Rejected proposal

An S — Superseded proposal

W — Withdrawn proposal

In PEP 0 (Index of Python Enhancement (PEPs)), all the PEPs are officially enumerated and you can retrieve them by number, by type, and by state. In PEP 1 (PEP Purpose and Guidelines), officials detail the intent of the PEP, how to submit the PEP, how to fix and update the PEP, the mechanism for PEP reviews, and so on.

Why read PEP?

Whether you are new to Python, experienced practitioners, or experienced hackers, you should read the Python enhancement proposal.

In my opinion, reading PEP has at least the following benefits:

(1) Understand what features Python has, how they differ from other languages, why they were designed, how they were designed, and how they can be used better;

(2) Follow up the community dynamics, learn the best practices in the industry, adjust the learning direction, and improve the content of work and business;

(3) Contribute to the Python community by participating in hot topic discussions or submitting new PEPs.

In the end, learning to program in Python is just scratching the surface. The PEP proposal is a way into Python, a key to a true mastery of the language, and a guide to getting comfortable with Python.

Which PEPs are required to read?

As mentioned earlier, PEP proposals have accumulated to 478, and we don’t need to be familiar with every PEP, not necessarily. Here are some PEPs that I recommend you read:

PEP 0 — Index of Python Enhancement Proposals

PEP 7 — Style Guide for C Code, C extensions

PEP 8 — Style Guide for Python Code, Coding Specifications (Required)

PEP 20 — The Zen of Python

PEP 202 — List Comprehensions, List generation

PEP 274 — Dict Comprehensions, dictionary generation

PEP 234 — Iterators

PEP 257 — Docstring Conventions, Document annotation Conventions

PEP 279 — The Enumerate () built-in function, enumerate

PEP 282 — A Logging System, Logging module

PEP 285 — Adding A bool Type, Boolean value

PEP 289 — Generator Expressions, Generator Expressions

PEP 318 — Decorators for Functions and Methods, Decorators

PEP 342 — Coroutines via Enhanced Generators, Coroutines

PEP 343 — The “with” Statement, with Statement

PEP 380 — Syntax for Delegating to a Subgenerator, yield from Syntax

PEP 405 — Python Virtual Environments

PEP 471 — os.scandir() function, traverses the directory

PEP 484 — Type Hints, Type constraints

PEP 492 — Coroutines with async and await syntax, async/await syntax

PEP 498 — Literal String Interpolation Python, String Interpolation

PEP 525 — Asynchronous Generators

PEP 572 — Assignment Expressions, Most controversial

PEP 3105 — Make print a function, print changes to a function

PEP 3115 — Metaclasses in Python 3000, metaclass

PEP 3120 — Using UTF-8 as the default source encoding

PEP 3333 — Python Web Server Gateway Interface V1.0.1, Web development

PEP 8000 — Python Language Governance Proposal Overview, after GvR launches the decision layer, it is related to the new decision scheme

Contributions to PEP

There are probably more Python developers in China than in any other country, although there are no exact figures to prove it. However, when I looked at the 200 + PEP authors listed in PEP 0, I only saw one Chinese name that looked like Hanyu Pinyin (not to mention missing or using an English name). The contrast couldn’t be greater.

I also very much hope that the names of Python hackers in The country will appear more and more on that list, on the list of core Python developers.

In addition, a very effective way to contribute to PEP is to translate pePs into Chinese for the benefit of the Python learning community back home. After a bit of searching, I didn’t see a project to systematically translate PEPs, only a few translations for a particular PEP.

Express my selfishness, I hope this article can bring you the growth of knowledge and knowledge, stimulate the enthusiasm for learning partners!