[Python-ideas] Minor tweak to PEP 8?

Steven D'Aprano steve at pearwood.info
Wed May 11 18:55:08 CEST 2011


Mike Meyer wrote:

>> I think that specifying exactly how to indent continuation lines, or 
>> even whether or not to indent them, is way too controlling for my 
>> tastes. I don't believe it makes that much difference. Like the brace 
>> wars, if there actually was any objective, meaningful, consistent 
>> benefit of one style over the others, there would be no argument about 
>> it. Instead, it's all subjective, vague, and far from consistent.
> 
> If you don't believe it makes much different "whether or not to indent
> them", I suggest you align all continuation lines on the left hand
> side of the page in code you have to maintain and then report back to
> us.

In general, that would be an *outdent*, rather than not indenting.

As a matter of fact, there is at least one situation where I don't 
indent continuation lines:

         if condition:
             do_something("some long piece of text, most likely"
             " but not always an error message, which uses implicit"
             " concatenation over multiple lines blah blah blah blah"
             % spam)
             # and it's perfectly maintainable, thanks for asking.


The fact that I have bare strings (with a leading space) and/or a binary 
operator is more than enough clue that the lines form a block. Indenting 
would be superfluous, and counter-productive, as it would reduce the 
space available on each line.



-- 
Steven




More information about the Python-ideas mailing list