Terry Reedy wrote:
However, this 'beautiful' code has a trap. If one gets rid of the
seemingly unneeded temporary list res by telescoping the last two lines
into a bit too much into
yield tuple(next(i) for i in iters)
we now have an infinite generator, because tuple() swallows the
StopIteration raised as a side-effect of next calls.
An excellent example of the kind of thing that PEP 479
is designed to catch! There couldn't be a better
advertisement for it. :-)
--
Greg
--
https://mail.python.org/mailman/listinfo/python-list