Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Current Status of PEP 8 Rules?

Are all PEP 8 rules still valid?

Are there any which are obsolete?

Isn't there a more explanatory cheat sheet that this one.

like image 293
vidul Avatar asked Oct 17 '10 18:10

vidul


People also ask

What are pep 8 guidelines?

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.

Should I follow PEP8?

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.

Which of the following are best practices when following the guideline in PEP 8?

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.

Which choice is PEP 8 compliant as the name of a class?

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.


2 Answers

Here is the current version of PEP 8. It was last updated 2010 August 29.

like image 108
逆さま Avatar answered Sep 30 '22 13:09

逆さま


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!

like image 21
Adam Vandenberg Avatar answered Sep 30 '22 14:09

Adam Vandenberg