I'll try to find a concrete one tomorrow. I did this recently, but I might have factored it away somehow. The real life code has lots of extraneous parts that need to be removed or simplified though. Both because they aren't FLOSS, and because the details would muddy things. "Trimmed from real" won't look much different than "invented from scratch".
And yes, OF COURSE everything CAN be rewritten. But that's true in regards to *every* proposed addition. The sentinel break_outer variable is often the was to do it without really big restructuring (but with a handful of ugly bookkeeping lines instead). On Sat, May 11, 2019, 11:22 PM Chris Angelico <ros...@gmail.com> wrote: > On Sun, May 12, 2019 at 1:16 PM David Mertz <me...@gnosis.cx> wrote: > > > > Ok, sure. But what if different seen_enough() conditions are in the two > inner loops? By "break to outer" ... I mean, don't get any more 'main' from > 'stuff'. I meant to dig through some real code, but forgot because I was > writing code for work. This example on my tablet is the general pattern I > often need though. And obviously I've solved it one way or another hundreds > of times. > > > > I think a "labelled break" would be nice though. It might have even been > a past PEP. > > > > This is why concrete examples are much easier to discuss, heh. > > In any case, it's often possible to either (a) redefine the inner loop > as some sort of container operation, or (b) redefine the outer > operation as a function, and use "return". So it would be helpful to > have an example that CAN'T be rewritten in one of those ways, to use > as a compelling example. > > ChrisA > _______________________________________________ > 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/