| The various examples are synthetic. The use of a helper-function is given in the lwn article as a reason for not supporting multi-level break: ] The solution to "Python needs a way to jump out of a chunk of code" is usually to put the chunk of code into a function, then return out of it. More specifically: ] To make this proposal convincing, we need a realistic example of an algorithm that uses it, and that example needs to be significantly more readable and maintainable than the refactorings into functions, or the use of try…except (also a localised goto). ] If you intend to continue to push this idea, I strongly suggest you look at prior art: find languages which have added this capability, and see why they added it. The multi-level break in that Rust example may be "more readable and maintainable than the refactorings into functions", but it is not "significantly more readable." |
> The solution to "Python needs a way to increment variables" is usually to so `a = a + 1`.
> To make this proposal convincing, we need a realistic example of an algorithm that uses it, and that example needs to be significantly more readable and maintainable than `a = a + 1`.
Why does `+=` get into the language but labelled breaks (a reasonably standard feature) don't. This isn't hypothetical - not all languages have +=. Matlab for example requires you to do `a = a + 1`.