Continuing indentation

Ian Kelly ian.g.kelly at gmail.com
Fri Mar 4 10:25:49 EST 2016


On Fri, Mar 4, 2016 at 7:03 AM, alister <alister.ware at ntlworld.com> wrote:
> On Fri, 04 Mar 2016 10:12:58 +0000, cl wrote:
>
>> Steven D'Aprano <steve at pearwood.info> wrote:
>>> On Fri, 4 Mar 2016 12:23 pm, INADA Naoki wrote:
>>>
>>>
>>> >>
>>> >> Indeed. I don't understand why, when splitting a condition such as
>>> >> this,
>>> >> people tend to put the operator at the end of each line.
>>> >>
>>> >>
>>> > Because PEP8 says:
>>> >
>>> >> The preferred place to break around a binary operator is after the
>>> > operator, not before it. http://pep8.org/#maximum-line-length
>>>
>>> PEP 8 is wrong :-)
>>>
>> Yes, I agree.  In my mind the logic is:-
>>
>>     IF xxx
>>         AND yyy AND zzz OR aaa
>>     THEN do something
>>
>> The PEP8 correct(er):-
>>
>>     IF xxx AND
>>          yyy AND zzz OR aaa
>>     THEN do something
>>
>> ... just seems all wrong and difficult to understand.
>
> not at all
> the split after the operator shows that their is more to that line
> splitting before & the reader could believe that the condition ends there
>
> PEP 8 is mos definitely correct on this one

I disagree. When I'm skimming over code, I find it unlikely that I'll
read the last token of the line. That's where trivialities like
arguments to function calls are found. It's much more likely that I'll
read the first token of the next line.



More information about the Python-list mailing list