Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Is PEP-8 dead?
#7
Even in the main python documentation there are examples of code that is not PEP8/best practice compliant. I don't think we have to enforce PEP-8. I always mention when the code under discussion is not PEP8 compliant, but I have nether the time nor desire to correct everything. Also sometimes code under discussion is so non-pythonic that CamelCase is the least of problems.
Finally, as PEP8 states
Quote:Many projects have their own coding style guidelines. In the event of any conflicts, such project-specific guides take precedence for that project.
A Foolish Consistency is the Hobgoblin of Little Minds

One of Guido's key insights is that code is read much more often than it is written. The guidelines provided here are intended to improve the readability of code and make it consistent across the wide spectrum of Python code. As PEP 20 says, "Readability counts".

A style guide is about consistency. Consistency with this style guide is important. Consistency within a project is more important. Consistency within one module or function is the most important.

However, know when to be inconsistent -- sometimes style guide recommendations just aren't applicable. When in doubt, use your best judgment. Look at other examples and decide what looks best. And don't hesitate to ask!

In particular: do not break backwards compatibility just to comply with this PEP!

Some other good reasons to ignore a particular guideline:

When applying the guideline would make the code less readable, even for someone who is used to reading code that follows this PEP.
To be consistent with surrounding code that also breaks it (maybe for historic reasons) -- although this is also an opportunity to clean up someone else's mess (in true XP style).
Because the code in question predates the introduction of the guideline and there is no other reason to be modifying that code.
When the code needs to remain compatible with older versions of Python that don't support the feature recommended by the style guide.
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs

Reply


Messages In This Thread
Is PEP-8 dead? - by volcano63 - Oct-20-2018, 09:39 AM
RE: Is PEP-8 dead? - by snippsat - Oct-20-2018, 11:07 AM
RE: Is PEP-8 dead? - by volcano63 - Oct-20-2018, 11:26 AM
RE: Is PEP-8 dead? - by snippsat - Oct-20-2018, 12:57 PM
RE: Is PEP-8 dead? - by ichabod801 - Oct-20-2018, 02:06 PM
RE: Is PEP-8 dead? - by volcano63 - Oct-20-2018, 02:52 PM
RE: Is PEP-8 dead? - by buran - Oct-20-2018, 03:02 PM
RE: Is PEP-8 dead? - by wavic - Oct-20-2018, 03:32 PM
RE: Is PEP-8 dead? - by metulburr - Oct-20-2018, 06:15 PM
RE: Is PEP-8 dead? - by nilamo - Oct-25-2018, 12:43 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Is comp.lang.python dead? Winfried 3 4,757 Aug-25-2018, 12:04 AM
Last Post: metulburr
  WYSIWYG dead, source mode enabled metulburr 0 2,846 May-31-2017, 01:26 PM
Last Post: metulburr

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020