Re:The optional “else” in Python loops
by avn2109 on Thursday July 17, 2014 @11:58PM
(#8051593)
What about using "finally," which if IIRC is already a thing in Python and encapsulates this idea pretty neatly?
[ Parent
| on HN ]
finally blocks are always executed; this kind of else block is only executed if the for block exited normally (i.e. did not throw an exception).
How about a keyword such as "after"? I feel like that could have extensible potential in other areas of the language, and the name makes a little sense logically speaking.