[Python-ideas] Silent bugs - was Re: PEP8 operator must come before line break
Erik
python at lucidity.plus.com
Thu Apr 14 16:30:56 EDT 2016
On 14/04/16 21:04, Chris Angelico wrote:
> However, I wouldn't write it like *either* of those. To me, the options are:
>
> result = expr1 +
> expr2
>
> and
>
> result = expr1
> + expr 2
Agreed, and the second one is how I prefer to format my C code too.
> So indenting the continuation is even better than
> choosing where to place the binary operator.
The two are not mutually exclusive. Indenting the continuation tackles
the "silent bug" issue, while choosing where to place the operator is
purely a readability issue - hence I prefer the second of your examples
... it addresses both problems from my POV.
However, that doesn't answer my question of when a line consisting of
just "+ expr" is a useful thing.
E.
More information about the Python-ideas
mailing list