On 03/03/2017 08:21 AM, Matthias Bussonnier wrote:

##################################################
# forloop.break(), to break out of nested loops (or explicitly out of
current
#loop) - a little like pep-3136's first proposal

has_dog_named_rex = False
for owner in owners:
     for dog in dogs:
         if dog.name == "Rex":
             has_dog_named_rex = True
             break

     if has_dog_named_rex:
         break

# would be equivalent to

for owner in owners as owners_loop:
     for dog in dogs:  # syntax without "as" is off course still supported
         if dog.name == "Rex":
             owners_loop.break()

See my above proposal, you would still need to break the inner loop
here as well. So i'm guessing you miss a `break` afrer owner_loop.break() ?

No, he's not -- part of implementing this change includes not needing to 
specify the inner breaks.

--
~Ethan~

_______________________________________________
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to