Guido sees the light: PEP 8 updated

Chris Angelico rosuav at gmail.com
Sat Apr 16 05:30:21 EDT 2016


On Sat, Apr 16, 2016 at 6:51 PM, Marko Rauhamaa <marko at pacujo.net> wrote:
> Chris Angelico <rosuav at gmail.com>:
>
>> On Sat, Apr 16, 2016 at 6:06 PM, Marko Rauhamaa <marko at pacujo.net> wrote:
>>> It doesn't really matter one way or another. The true WTF is that it's
>>> been changed.
>>
>> Why? Was PEP 8 inscribed on stone tablets carried down from a mountain?
>
> In a way, yes.
>
> I don't follow PEP 8 to the tee; probably nobody does. However, I don't
> see the point of turning truckloads of exemplary Python code into
> truckloads of substandard Python code.

Let me quote to you from the most important section of PEP 8.

"""
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!
"""
(from the section "A Foolish Consistency is the Hobgoblin of Little Minds")

Maybe we need a blog post "Falsehoods Programmers Believe About PEP
8", along the lines of the ones about time and names. Remember, every
one of these is false.

* All Python code should follow PEP 8.
* If you use a tool named pep8, your code will be PEP 8 compliant.
* If your code is PEP 8 compliant, a tool named pep8 will accept it.
* The Python Standard Library is PEP 8 compliant.
* Okay, at least the new parts of the standard library are PEP 8 compliant.
* PEP 8 compliant code is inherently better than non-compliant code.
* PEP8-ing existing code will improve it.
* Once code is PEP 8 compliant, it can easily be kept that way through
subsequent edits.
* PEP 8 never changes.
* Well, it never materially changes.
* I mean, new advice, sure, but it'll never actually go back on a rule.

Contributions welcomed.

ChrisA



More information about the Python-list mailing list