[Python-ideas] PEP8 operator must come before line break
Ethan Furman
ethan at stoneleaf.us
Thu Apr 14 21:07:48 EDT 2016
On 04/14/2016 05:45 PM, Nathaniel Smith wrote:
> On Thu, Apr 14, 2016 at 12:28 PM, Joseph Martinot-Lagarde wrote:
> I actually find a similar effect for and/or chains, where the
> beginning-of-line format makes things lined up and easier to scan --
> e.g. comparing these two options:
>
> return (something1() and
> f() and
> some_expression > 1 and
> (some_other_thing() == whatever or
> blahblah or
> asdf))
>
> return (something1()
> and f()
> and some_expression > 1
> and (some_other_thing() == whatever
> or blahblah
> or asdf))
>
> then I find the second option dramatically more readable. But maybe
> that's just me -- for and/or the argument is a bit less compelling,
> because you don't regularly have chains of different operators with the
> same precedence, like you do with +/-.
I agree. ;)
Most of my continuation lines are with `and` and `or`, and I try to keep
the logical pieces on one line with the join `and` or `or` beginning the
next line.
Much easier for me to read.
--
~Ethan~
More information about the Python-ideas
mailing list