[Python-ideas] allow line break at operators

MRAB python at mrabarnett.plus.com
Mon Sep 5 01:01:08 CEST 2011


On 04/09/2011 23:26, Ben Finney wrote:
> MRAB<python at mrabarnett.plus.com>  writes:
>
>> I don't have a use-case, I was just wondering whether in this:
>>
>>      first
>>          second
>>              third
>>          fourth
>>
>> "third" is a continuation, giving this:
>>
>>      first
>>          second third
>>          fourth
>>
>> which has 2 continuations, leading to this:
>>
>>      first second third fourth
>
> I do this routinely in my code, using bracketing syntax. It's useful for
> visually showing the structure of moderately complex generator
> expressions or function calls, for instance.
>
>> As well as still limiting a comment to a line, I'd also still limit a
>> string literal (except a triple-quoted string literal) to a line.
>
> How many string literals do you count in the following statement? I
> count one:
>
>      raise HoustonWeHaveAProblemError(
>          "Lorem ipsum dolor sit amet,"
>          " consectetur adipiscing elit.")
>
It depends on how you count them. :-)

What I mean is that I'd still forbid a newline between the quotes. Is
this acceptable?

     "Lorem ipsum dolor sit amet,
       consectetur adipiscing elit."

I'd say not.



More information about the Python-ideas mailing list