There are so many things for new Python programmers to learn beyond the syntax of the language.  Python libraries, modules, versions – I could go on…

Something that seems to be somewhat confusing to new Pythonistas is PEP.   I’ll try and clear up some of that confusion today.

PEP – Python Enhancement Proposals

PEP stands for Python Enhancement Proposals.  PEPs are numbered documents that describe or propose new features for Python, its processes, or environment.  PEPs are just versioned text files in a repository that serve as a historical record of the feature proposal’s for Python.

Fittingly you can read PEP 1 – PEP Purpose and Guidelines for a deep dive.

All PEPs start with an idea and a champion.  A champion is just the person that writes the idea in the correct format and style and tries to build support for it.  After a PEP is drafted and submitted it is reviewed and the PEP editors approve it or deny it.

If it is approved at this step it does not mean the PEP was accepted!  That just means it gets a number and starts the process as shown below.

pep flow chart
Source: https://www.python.org/dev/peps/pep-0001/

Famous PEPs

While there are Python purists out there that believe every PEP is sacred, in our opinion some are more important than others.

The latest PEP to be accepted at the time of this writing is PEP 570 — Python Positional-Only Parameters.   PEP 570 introduces "/" for specifying positional-only parameters in Python function definitions.

PEP 8 — Style Guide for Python Code is probably the most famous PEP.  It was written by none other than Guido van Rossum himself and outlines “coding conventions”  for Python.   If you are going to write Python code you have to read this; even if just to know what the guidelines are so you know how you want to break them…

One of the reasons Python is such a  beautiful language is because of guidelines in PEP 8 for writing and maintaining readable, consistent code.    The idea is that if you have coders that are all following PEP 8 is should be trivial for one programmer to read and interact with,  maintain,  or improve another programmers code.

A slightly less serious PEP, PEP 20 builds on the idea that readability counts…

More PEPs

With hundreds of PEPs published there are so many that are worth reading.   While we haven’t read them all, here is a short list of some of the others that we suggest you investigate further:

  • PEP 257 — Docstring Conventions
  • PEP 3099 — Things that will Not Change in Python 3000
  • PEP 572 — Assignment Expressions
  • PEP 440 — Version Identification
  • PEP 274 — Dict Comprehensions
  • PEP 389 — argparse
  • PEP 483 — The Theory of Type Hints
  • PEP 3129 — Class Decorators

Leave a Reply

Your email address will not be published. Required fields are marked *