3 ms·
That logic definitely helps me think about it. But it does seem like a switch from the other wording that python uses. Feels like finally would be more intuitiv
by BWStearns 12y ago
That logic definitely helps me think about it. But it does seem like a switch from the other wording that python uses. Feels like finally would be more intuitive, whereas without thinking about the search loop case else feels like something that would be triggered by a break or return. I wonder if using the feature would be more common if it was more intuitively worded.
- maxerickson 12y agoIt's analogous to the natural termination of a while-else, where the else block is executed after the condition evaluates to false: >>> a=1 >>> while a>0: print(4) a=a-1 else: print('done') 4 done clarity cribbed from here: https://mail.python.org/pipermail/python-list/1999-July/004457.html https://mail.python.org/pipermail/python-list/1999-July/0044...
- MBlume 12y agoOh, that helps too -- it's an else clause for the conditional of the while loop :D
- MBlume 12y agofinally seems much more confusing to me -- the point of finally is that it will definitely be executed...