On 04/12/2019 23:41:19, Andrew Barnert via Python-ideas wrote:
On Dec 4, 2019, at 12:14, Mike Miller <python-id...@mgmiller.net> wrote:

On 2019-12-04 11:05, David Mertz wrote:
I've often wanted named loops. I know approaches to this have been proposed 
many times, and they all have their own warts. E.g. an ad hoc pseudo code that 
may or may not match any previous proposal:
for x in stuff as outer:
     for y in other_stuff as inner:
         ...
         if cond:
             break outer
But we all manage without it.
+1  Nice, find myself with that problem about once a year and it is annoying to 
code around
If you want to change this from an aside to a real proposal, it’s probably 
worth starting a new thread (and providing a real-life use case—if we all run 
into it once a year, many people probably won’t remember exactly what it looked 
like when they last ran into it, and how much their workaround bothered them).
My experience in this area:
I've sometimes found myself wanting to write
    break break
to break out of 2 loops at once
and probably
    break break break
to break out of 3 loops.  (Any more and the code starts to look pretty ugly - but any feature can be abused.)

This could lead (in complicated examples) to code would be harder to maintain than if it used named loops, but
    it is concise
    it is backward-compatible
    it could AFAIK be checked at compile time (for more "break"s than enclosing loops)
    it does not require a new keyword
    IMO it would handle a large majority of use cases.

Rob Cliffe

_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/JUGJIGEMT7KZ345VYM4CWJD2XWPKPQEH/
Code of Conduct: http://python.org/psf/codeofconduct/


_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/MQM4VHWJWCZ4PHI4T3NK3HQALK5CEUQ6/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to