Python allows for breaking out from a loop through 'break' and
'continue' keywords. It would be nice if it was possible to break many
loop levels using one command.
I propose two constructions for that:
break
break break
break break break
...
continue
break continue
break break continue
...
And so on.
Example:
for i in range(10):
for j in range(10):
if i == 2 and j == 3:
break break
for i in range(10):
for j in range(10):
if i == 2 and j == 3:
break continue
if i == 7:
break break
Breaking out from many loops at once is a common practice, currently
implemented through boolean testing and exceptions. This proposal would
make it cleaner.
_______________________________________________
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/