Continuing indentation

sohcahtoa82 at gmail.com sohcahtoa82 at gmail.com
Fri Mar 4 19:06:51 EST 2016


On Friday, March 4, 2016 at 3:41:29 PM UTC-8, Ben Finney wrote:
> alister <alister.ware at ntlworld.com> writes:
> 
> > On Fri, 04 Mar 2016 10:23:37 +0900, INADA Naoki wrote:
> >
> > > 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
> >
> > and that is to make it obvious that there is more to come.
> 
> That's a good way to express it.
> 
> I think there are competing models here:
> 
> * When breaking an expression between two lines, put the binary operator
>   at the end of the earlier line.
> 
>   This makes it obvious what's going on when reading the earlier line.
> 
> * When breaking an expression between two lines, put the binary operator
>   at the beginning of the later line.
> 
>   This makes it obvious what's going on when reading the continuation
>   line.
> 
> Both have merit. Both models make an almost-identical appeal to
> readability.
> 
> We can't put the binary operator in multiple places,

<snip>

Who are you, the binary operator police?  Watch me!

if x == y and \
        x == z and \
        a > b \
        or b > c \
        and (d is not \
        None \
        ):
    pass

You're not the boss of me!

And that code hurt to write...



More information about the Python-list mailing list