Skip to Content
Daniel Arbuckle's Mastering Python
book

Daniel Arbuckle's Mastering Python

by Daniel Arbuckle
June 2017
Beginner to intermediate content levelBeginner to intermediate
274 pages
6h 49m
English
Packt Publishing
Content preview from Daniel Arbuckle's Mastering Python

PEP 8 — guidelines for Python code

The very first rule PEP 8 introduces is that rules/guidelines in PEP 8 should only apply when they make our code easier to read. This means we should apply PEP 8 to enhance the readability of the code and to make it less complex. For example, if we're working on a project that was already written with a different coding style (that is, it is already easy to read), we should use that project style for new code. If the PEP 8 rules somehow make the code harder to read or make it complex while writing the code, we should ignore those rules. As Guido Van Rossum, the creator of Python, has noted:

Code is read more often than it is written.
Code should always be written in a way that promotes readability.

For more ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Hands-On Deep Learning for Games

Hands-On Deep Learning for Games

Micheal Lanham
Mastering PyCharm

Mastering PyCharm

Nafiul Islam
Python: Journey from Novice to Expert

Python: Journey from Novice to Expert

Fabrizio Romano, Dusty Phillips, Rick van Hattem

Publisher Resources

ISBN: 9781787283695Supplemental Content