[Python-ideas] for/except/else

Joao S. O. Bueno jsbueno at python.org.br
Thu Mar 2 14:01:56 EST 2017


On 1 March 2017 at 06:37, Wolfgang Maier
<wolfgang.maier at biologie.uni-freiburg.de> wrote:
> Now here's the proposal: allow an except (or except break) clause to follow
> for/while loops that will be executed if the loop was terminated by a break
> statement.

After rethinking over some code I've written in the past, yes, I agree
this change could be a nice one.
The simple fact that people are commenting that they could chage the
code to be an inner
function in order to break from nested "for" loops should be a hint
this syntax is useful. (I myself have done that with exceptions in some cases).

   js
 -><-


More information about the Python-ideas mailing list