[Python-Dev] PEP 340: Breaking out.

Guido van Rossum gvanrossum at gmail.com
Wed May 4 00:39:04 CEST 2005


> FWIW, I expect most generators used in block-syntax to not be loops.
> What would imply to support these to pass "break" to parent loop at
> run-time?

I proposed this at some point during the discussion leading up to the
PEP and it was boohed away as too fragile (and I agree). You're just
going to have to learn to deal with it, just as you can't break out of
two nested loops (but you can return from the innermost loop).

> Maybe generators are not the way to go, but could be
> supported natively by providing a __block__ function, very similarly to
> sequences providing an __iter__ function for for-loops?

Sorry, I have no idea what you are proposing here.

-- 
--Guido van Rossum (home page: http://www.python.org/~guido/)


More information about the Python-Dev mailing list