I don't love the 'break break' syntax idea. But I find myself wanting to
break out of nested loops quite often. Very rarely could this be
transformed to an 'itertools.permutation' de-nesting, albeit perhaps more
often than I actually do that.

My usual kludge is a sentinel 'break_outer' variable that gets set back and
forth between True and False working the loops. Usually work a name that
descriptive of the actual domain of the code.

On Sat, May 11, 2019, 1:40 PM Paul Moore <p.f.mo...@gmail.com> wrote:

> On Sat, 11 May 2019 at 18:22, haael <ha...@interia.pl> wrote:
> > Breaking out from many loops at once is a common practice
>
> Do you have evidence for this? In my experience, it's very rare
> (although I concede it would be *occasionally* convenient).
>
> In most cases where I'd consider breaking out of multiple levels of
> nested loop, I've tended to find that it's probably more readable to
> refactor the code to use a generator, or something like that.
> Paul
> _______________________________________________
> Python-ideas mailing list
> Python-ideas@python.org
> https://mail.python.org/mailman/listinfo/python-ideas
> Code of Conduct: http://python.org/psf/codeofconduct/
>
_______________________________________________
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to