How to break out of two nested for loops?
cliechti at gmx.net
Mon Jan 21 17:10:46 EST 2002
"Francois Petitjean" <littlejohn.75 at free.fr> wrote in
news:3c4c8a45$0$3191$626a54ce at news.free.fr:
> break # break 2 ??
> A simple solution would be to have a nested function interp_i with
> ret = self.match(line)
> if ret: return ret
some day ago there was a discussion right about that....
however a simple solution is to raise an exception and catch it outside the
class Stop(Exception): pass
if ...: raise Stop
you could also throw some existing Exception, but when you use you own
youre sure that you don't accidently drain an error.
Chris <cliechti at gmx.net>
More information about the Python-list