Re:The optional “else” in Python loops
by wting on Thursday July 17, 2014 @08:42PM
(#8051105)
Raymond Hettinger has suggested that instead of `else:` the keyword should have been called `nobreak:` which conveys intentions better.
[ Parent
| on HN ]
What about using "finally," which if IIRC is already a thing in Python and encapsulates this idea pretty neatly?
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.
or something like "then"?
Re:The optional “else” in Python loops
by BerislavLopac on Friday July 18, 2014 @06:22AM
(#8052365)
Or "unbroken", even... ;-)