On Jun 10, 10:07 am, "Kris Kowal" <[EMAIL PROTECTED]> wrote: > 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()
Have you checked out http://www.python.org/dev/peps/pep-3136/ It contains exactly this idea, but using 'break letters' rather than 'raise letters.StopIteration()'. I think I like the PEP's syntax better than yours, but anyway, it was rejected. -- Paul Hankin -- http://mail.python.org/mailman/listinfo/python-list