Raymond Hettinger wrote:
> It's a PITA because it precludes all of the use cases whether the
> inputs ARE intentionally of different length (like when one argument
> supplys an infinite iterator):
>
> for lineno, ts, line in zip(count(1), timestamp(), sys.stdin):
> print 'Line %d, Time %s: %s)' % (lineno, ts, line)
which is a much more complicated way of writing:
for lineno, line in enumerate(sys.stdin):
ts = time.time()
...
[assuming your "timestamp()" is what I think it is, never heard of it
before].
I double-checked my own uses of zip() and they seem to follow the trend of
those in Python stdlib: most of the cases are really programming errors if
the two sequences do not match in length. I reckon the usage of infinite
iterators is generally much less common.
--
Giovanni Bajo
_______________________________________________
Python-3000 mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-3000
Unsubscribe:
http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com