why no break N levels, as in other leading languages?

Aahz aahz at pythoncraft.com
Thu May 1 19:58:21 EDT 2003


In article <87ptn2xx5o.fsf at jidanni.org>,
Dan Jacobson  <jidanni at dman.ddts.net> wrote:
>
>... oops, where were we? Anyway, in python did he forget
>about giving it a N ability or is there of course some higher
>principle involved?

class BreakException(Exception):
    pass

try:
    for i in range(foo):
        for j in range(bar):
            for k in range(spam):
                if my_func():
                    raise BreakException
except BreakException:
    pass
-- 
Aahz (aahz at pythoncraft.com)           <*>         http://www.pythoncraft.com/

"In many ways, it's a dull language, borrowing solid old concepts from
many other languages & styles:  boring syntax, unsurprising semantics,
few automatic coercions, etc etc.  But that's one of the things I like
about it."  --Tim Peters on Python, 16 Sep 93




More information about the Python-list mailing list