Proposal: [... for ... while cond(x)]

Nick Mellor thebalancepro at gmail.com
Thu Sep 26 10:50:36 EDT 2013


On Friday, 27 September 2013 00:39:30 UTC+10, Nick Mellor  wrote:

[snip]
> for x in xs:
>     if not emit:
>         if cond(x):
>             emit = True
>     else:
>         yield e(x)
> 

Oops!

for x in xs:
   if not emit:
       if cond(x):
           emit = True
           yield e(x)
   else:
       yield e(x)



More information about the Python-list mailing list