[EMAIL PROTECTED] schrieb:
> Any elegant way of breaking out of the outer for loop than below, I
> seem to have come across something, but it escapes me
> 
> for i in outerLoop:
>    for j in innerLoop:
>        if condition:
>           break
>    else:
>        continue
>     break

It's working because for-loops else statements are are executed only if 
the loop hasn't been terminated unexpectedly. Which is what happens 
here: if the inner loop is breaked, it's else is not executed. So the 
outer loop's break is called.

Diez
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to