Author tomirendo
Recipients tomirendo
Date 2014-10-29.21:27:46
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
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)) #()
Date User Action Args
2014-11-01 00:50:36terry.reedyunlinkissue22761 messages
2014-10-29 21:27:46tomirendosetrecipients: + tomirendo
2014-10-29 21:27:46tomirendosetmessageid: <>
2014-10-29 21:27:46tomirendolinkissue22761 messages
2014-10-29 21:27:46tomirendocreate