replacing `else` with `then` in `for` and `try`

Wolfgang Maier wolfgang.maier at biologie.uni-freiburg.de
Thu Nov 2 13:47:57 EDT 2017


On 11/02/2017 06:09 PM, Skip Montanaro wrote:
> Eh, what can I say? I guess I was paying too much attention to the baseball
> game. Yes, "else" handles the "fall off the end" termination, not the "exit
> early" termination. My apologies. I do think that having a way to spell "do
> this when the loop exits early" makes things clearer. So, perhaps while and
> for loops could someday grow except clauses. :-)
> 

... and even this idea has been discussed before:

https://mail.python.org/pipermail/python-ideas/2017-March/044932.html

There wasn't much enthusiasm about it though because few people (ok, 
maybe even just me) thought it had interesting use cases.




More information about the Python-list mailing list