[Python-ideas] Control Flow - Never Executed Loop Body

Thomas Güttler guettliml at thomas-guettler.de
Thu Mar 24 09:54:38 EDT 2016


Am 20.03.2016 um 19:12 schrieb Sven R. Kunze:
> Hi Python-ideas,
>
> ..
> for item in my_iterator:
>       # do per item
> empty:

Yes, this looks good.

What about this?

{{{

for item in my_iterator:
     # do per item
on empty:
    # this code gets executed if iterator was empty
on break:
    # this code gets executed if the iteration was left by a "break"
on notempty:
    # ...

}}}

Is there a case which I have forgotten?

... I have no clue how to implement this :-)

Regards,
   Thomas


-- 
Thomas Guettler http://www.thomas-guettler.de/


More information about the Python-ideas mailing list