[Python-ideas] Is this PEP-able? for X in ListY while conditionZ:

Joshua Landau joshua.landau.ws at gmail.com
Sat Jun 29 17:46:11 CEST 2013


On 29 June 2013 11:09, Nick Coghlan <ncoghlan at gmail.com> wrote:
> Rather than adding a new keyword, we could simply expand the syntax
> for the existing break statement to be this:
>
>     break [if <EXPR>]
...
> Once the break statement has been redefined this way, it *then*
> becomes reasonable to allow the following in comprehensions:
>
>     data = [x for x in iterable break if x is None]

Almost all of your proposal looks reasonable, but I personally find
this quite hard to read; it should be written along the lines of (I'm
not proposing this):

    x for x in iterable; break if x is None

if one is to continue having syntax that is pseudo-correct English - a
trait I am eager to to keep.

In summary, this is hard for me to read because there is no separation
of the statements.


Because I have not other substantial objections, I'm -0 on this. If
you can find a way to "fix" that, I'll be, for all intents and
purposes, neutral.


More information about the Python-ideas mailing list