Are all PEP 8 rules still valid?
Are there any which are obsolete?
Isn't there a more explanatory cheat sheet that this one.
PEP 8, sometimes spelled PEP8 or PEP-8, is a document that provides guidelines and best practices on how to write Python code. It was written in 2001 by Guido van Rossum, Barry Warsaw, and Nick Coghlan. The primary focus of PEP 8 is to improve the readability and consistency of Python code.
PEP8 is for humans but your program will run even if you do not follow it. If you do not share your code and do not plan to do so, do whatever you want. If you plan to share some part of your code someday, then you should follow PEP8.
PEP 8 specifies the following rules for the inline comments. Start comments with the # and single space. Use inline comments carefully. We should separate the inline comments on the same line as the statement they refer.
I try to adhere to the style guide for Python code (also known as PEP 8). Accordingly, the preferred way to name a class is using CamelCase: Almost without exception, class names use the CapWords convention.
Here is the current version of PEP 8. It was last updated 2010 August 29.
PEP 8 is still the preferred style guide for Python code. Watching the changes to Django, for instance, I see edits for PEP 8 (such as "2 blank lines after the imports.)
They are still suggestions, though strong ones, and differences in house style are out there.
I didn't know about that cheat-sheet before; seems like having one like that is a good idea!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With