Hi Brice, On Fri, Mar 3, 2017 at 10:00 AM, Brice PARENT <cont...@brice.xyz> wrote: > Thanks Matthias for taking the time to give your opinion about it. > > Just to set the focus where I may have failed to point it: > the main purpose of this proposal is the creation of the object itself, an > object representing the loop. What we can do with it is still a sub-level of > this proposal, as the presence of this object is what allows all these > simplifications, and offers a lot of possibilities. > A 2 level breaking would have to be used this way : > > for outerloop, i in Loop(range(4)): > for innerloop, j in Loop(range(3)): > if i==2 and j==1: > outerloop.brk() > break # this
Thanks, I think it does make sens, I'm going to guess, outerloop.brk(inners=True) might also be helpful if you have more inners loops. I think that implicitely breaking inner ones might not always be the right thing to do so having a way to not break inner ones does make sens. The other possibility would be to allow the Loop object to catch raised exceptions and potentially continue running loops. Then you could "just" use raise to break multiple loops, but that might be a weird Loop/ContextManager hybrid. -- M _______________________________________________ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/