[Python-ideas] Re: Make for/while loops nameable.

2020-12-07 Thread Henk-Jaap Wagenaar
Just want to say that that is brilliant, and I would have not thought of that, that's a cool idea! Only annoyance is that it introduces an indentation, otherwise it'd be perfect! On Mon, 7 Dec 2020 at 23:30, Daniel Moisset wrote: > For the likely rare situation where I'd want to do this rather t

[Python-ideas] Re: Make for/while loops nameable.

2020-12-07 Thread Daniel Moisset
For the likely rare situation where I'd want to do this rather than refactoring into a function, I might try with something like this without requiring changes to the language: from contextlib import contextmanager @contextmanager def breakable(): class Break(Exception): pass def breaker(