Python Enhancement Proposals (PEP) are one of the reasons Python is such a well-respected programming language. PEPs are a design document that allows Python users to suggest improvements or features be added. These documents are used by the core developers to implement the new PEP if the steering committee agrees. While PEPs are essentially written for the Python core developers, they’re an excellent resource to improve Python skills and to discover new features of the language.
Python is known as a readable language. That is, you can almost read a program like a story.
x took a walk to memory land and found the int 8. He asked 8 if he could be his representative and 8 was very happy to say, ‘Yes’._
Not quite a story, but it reads with a story-like sentence. In this one, it changes a variable and focuses on the operation that transformed it.
This is aided by two concepts: readability and consistency. PEP 20 — The Zen of Python by Tim Peters encapsulates these concepts and others. It is a philosophical treatise on the Python language and a fun, easy read.
PEP 8 — Style Guide for Python sets a standard for Python. By understanding it, you’ll help yourself and others to maintain and refactor your code, while adding more functionality to it. Guido van Rossum attributed that code is read much more than it is written. This idea emphasizes the need for a consistent, readable codebase. PEP 8 is the best device to keep your code readable, consistent, and maintainable.
So, what should you take away from this reading? Be consistent. It will make your code more readable. Thus, embracing the very heart of the Python language.
Power up your Python prowess
Looking to learn more about PEP 8, PEP 257 (Docstring Conventions), and new features added to the Python road map? My course Python Enhancement Proposals will aid in learning to read and process PEPs. Isn’t it time you became a PEP-r too?
If you’re new to Python development check out our free Introduction to Python Development course, which gives will teach you how to read, write, and understand Python code, how to understand the basics of object-oriented programming (OOP), and how to develop Python projectors from start to finish.