yotamv added the comment: Inside a list comprehension expression, if a StopIteration exception is raised, the interpreter assumes the exception was raised by the object Iterated by the list comprehension expression.
For example, this generator will never stop, and will keep returning empty tuples: def izip(*args): iters = [iter(obj) for obj in args] while True: yield tuple(next(it) for it in iters) x = izip([1,2],[3,4]) print(next(x)) #(1,3) print(next(x)) #(2,4) print(next(x)) #() ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue22761> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com