[Python-Dev] iterzip()
Raymond Hettinger
python@rcn.com
2002年4月28日 20:16:30 -0400
From: "Guido van Rossum" <guido@python.org>
> Hm, I'm not particularly enamored of the idea of adding 'iter'
> versions of everything under the sun.
I'm already working on a separate module for iterators galore
(and will cross-check to Haskell to make sure I didn't miss anything).
I posted this one separately because zip() eats memory like crazy
and because a Python generator version crawls like a snail.
IMHO, This is a better way to loop over multiple sequences and
has a chance at becoming the tool of choice. I scanned all of my
Python code and found that iterzip() was a better choice in every
case except a matrix transpose coded as zip(*mat).
> I wish zip() could've been an
> interator from the start, but now that it isn't, I don't think it's
> such a big deal. (An iterator version is easily written as a
> generator.)
>> In general I'm not keen on increasing the number of builtin functions
> much.
Ditto. Any chance of moving functions like map(), reduce(), and filter()
to a functional module; pow() and divmod() to the math module; or
input() to oblivion?
Raymond Hettinger