If Python ever adopts the BCPL rule for implicit line continuation if the last thing on a line is an operator (or if there's an open parentheses), then the break-after-an-operator rule would be more persuasive. ;)
[IIRC, the BCPL rule was that there was an implicit continuation if the grammar would not allow inserting a semicolon at the end of the line, which covered both the open-parens and last-item-is-operator cases, and probably a few others.] But I should shut up and leave shut discussions to python-ideas. On 15 April 2016 at 13:48, Ian Lee <ianlee1...@gmail.com> wrote: > Cross posting the comment I’d left on the issue [1]. > > > My preference is to actually break that logic up and avoid the wrapping > in the first place, as in [2]. Which in this particular class has the side > benefit of that value being used again in the same function anyways. > > > I'm starting to realize that Brandon Rhodes really had a big impact on > my ideas of styling as I've been learning Python these past few years, as > this was another one style I'm stealing from that same talk [3]. > > [1] http://bugs.python.org/msg263509 > [2] > https://github.com/python/peps/commit/0c790e7b721bd13ad12ab9e6f6206836f398f9c4 > > ~ Ian Lee | ianlee1...@gmail.com > > On Apr 15, 2016, at 10:49, MRAB <pyt...@mrabarnett.plus.com> wrote: > > On 2016-04-15 18:03, Victor Stinner wrote: > > Hum. > > > > if (width == 0 > > and height == 0 > > and color == 'red' > > and emphasis == 'strong' > > or highlight > 100): > > raise ValueError("sorry, you lose") > > > > Please remove one space to vertically align "and" operators with the > > opening parenthesis: > > > > if (width == 0 > > and height == 0 > > and color == 'red' > > and emphasis == 'strong' > > or highlight > 100): > > raise ValueError("sorry, you lose") > > > > (I'm not sure that the difference is obvious in a mail client, you > > need a fixed width font which is not the case in my Gmail editor.) > > > > It helps to visually see that the multiline test and the raise > > instruction are in two different blocks. > > > > (Moreover, the pep8 checks of OpenStack simply reject such syntax, but > > I cannot use this syntax anymore :-)) > > > I always half-indent continuation lines: > > if (width == 0 > and height == 0 > and color == 'red' > and emphasis == 'strong' > or highlight > 100): > raise ValueError("sorry, you lose") > _______________________________________________ > Python-Dev mailing list > Python-Dev@python.org > https://mail.python.org/mailman/listinfo/python-dev > Unsubscribe: > https://mail.python.org/mailman/options/python-dev/ianlee1521%40gmail.com > > > > _______________________________________________ > Python-Dev mailing list > Python-Dev@python.org > https://mail.python.org/mailman/listinfo/python-dev > Unsubscribe: > https://mail.python.org/mailman/options/python-dev/pludemann%40google.com > >
_______________________________________________ Python-Dev mailing list Python-Dev@python.org https://mail.python.org/mailman/listinfo/python-dev Unsubscribe: https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com