[Python-ideas] allow line break at operators

Ben Finney ben+python at benfinney.id.au
Mon Sep 5 00:26:49 CEST 2011

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.")

 \     “Creativity can be a social contribution, but only in so far as |
  `\         society is free to use the results.” —Richard M. Stallman |
_o__)                                                                  |
Ben Finney

More information about the Python-ideas mailing list