Quoting Kris Kowal <[EMAIL PROTECTED]>:

> I had a thought that might be pepworthy.  Might we be able to break
> outer loops using an iter-instance specific StopIteration type?
> 
> This is the desired, if not desirable, syntax::
> 
>     import string
>     letters = iter(string.lowercase)
>     for letter in letters:
>         for number in range(10):
>             print letter, number
>             if letter == 'a' and number == 5:
>                 raise StopIteration()
>             if letter == 'b' and number == 5:
>                 raise letters.StopIteration()
> 

I must say, I don't even like the idea of having a 'break', but I kind of like
this proposal.

However, it may be ambiguous [is that a word?] if the outer and inner for loop 
over the same object. Weird/unlikely situation, I know... but so is having a
deep break :D.

-- 
Luis Zarrabeitia
Facultad de Matemática y Computación, UH
http://profesores.matcom.uh.cu/~kyrie


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

Reply via email to