qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v4 02/19] flake8: Enforce shorter line length for comments an


From: Markus Armbruster
Subject: Re: [PATCH v4 02/19] flake8: Enforce shorter line length for comments and docstrings
Date: Thu, 08 Apr 2021 10:32:06 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux)

Peter Maydell <peter.maydell@linaro.org> writes:

> On Fri, 26 Mar 2021 at 16:33, John Snow <jsnow@redhat.com> wrote:
>> Being less terse about it: Mostly, I don't like how it enforces this
>> column width even for indented structures. Generally, we claim that 72
>> columns is "comfortable to read" and I agree.
>>
>>                                     However, when we start in a margin, I
>>                                     am not convinced that this is
>>                                     actually more readable than the
>>                                     alternative. We aren't using our full
>>                                     72 characters here.
>
> I agree, and I don't see any strong reason to hold our Python
> code to a different standard to the rest of our codebase as
> regards line length and comment standards.

I can't see much of a conflict between canonical Python style and the
rest of our code.  (If there was a conflict, then I'd doubt we should
hold our Python code to a different standard than pretty much all the
other Python code out there.)

PEP 8 is expressly a *guide*.  It doesn't want to be treated as law.  It
tells you when to ignore its guidance even before it gives any, right in
the second section.  Applicable part:

    Some other good reasons to ignore a particular guideline:

    1. When applying the guideline would make the code less readable,
    even for someone who is used to reading code that follows this PEP.

Going beyond 72 colums to make the comment more readable is exactly what
PEP 8 wants you to do.

This is no excuse for going beyond when you could just as well break the
line earlier.

There's a reason pycodestyle distinguishes between errors and warnings,
and "line too long" is a warning.  We've been conditioned to conflate
warnings with errors by C's "the standard permits it, but you really
shouldn't" warnings.  However, treating style warnings as errors is
exactly what PEP 8 calls a folly of little minds.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]