Hacker News
new
|
past
|
comments
|
ask
|
show
|
jobs
|
submit
login
wting
on July 18, 2014
|
parent
|
context
|
favorite
| on:
The optional “else” in Python loops
Raymond Hettinger has suggested that instead of `else:` the keyword should have been called `nobreak:` which conveys intentions better.
avn2109
on July 18, 2014
|
next
[–]
What about using "finally," which if IIRC is already a thing in Python and encapsulates this idea pretty neatly?
dbarlett
on July 18, 2014
|
parent
|
next
[–]
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).
aperture
on July 18, 2014
|
root
|
parent
|
next
[–]
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.
gingerrr
on July 18, 2014
|
root
|
parent
|
next
[–]
or something like "then"?
BerislavLopac
on July 18, 2014
|
prev
[–]
Or "unbroken", even... ;-)
Guidelines
|
FAQ
|
Lists
|
API
|
Security
|
Legal
|
Apply to YC
|
Contact
Search: