6 Apr
2016
6 Apr
'16
2:16 p.m.
Am 24.03.2016 um 18:44 schrieb Sven R. Kunze:
On 24.03.2016 14:54, Thomas Güttler wrote:
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: # ...
Hmm, interesting. "on" would indeed be a distinguishing keyword to "except". So, "except" handles exceptions and "on" handles internal control flow (the iter protocol). Nice idea actually.
I thank you, because you had the idea to extend the loop syntax :-) But I guess it is impossible to get "on empty" implemented. Regards, Thomas Güttler -- Thomas Guettler http://www.thomas-guettler.de/