Raymond Hettinger added the comment:

FWIW, the usual ways to handle the double-break problem are:

* check a flag variable in the outer loop

* put the outer loop and inner loop in a function so that a return-statement 
can be used to exit both loops

* enclose the outer-loop in a try/except, then raise an exception to end the 
inner-loop

Your multi-break idea isn't crazy.  IIRC, Knuth discussed the idea (along with 
others such as labeled breaks) in one of his influential papers on structure 
programmiing.  That said, the idea didn't catch on and most people seem to be 
able to live easily without it.

----------
nosy: +rhettinger

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue19318>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to