[Python-Dev] iterzip() (original) (raw)

Guido van Rossum guido@python.org
Sun, 28 Apr 2002 20:32:53 -0400


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.

Do you have use cases where the memory use matters? I.e. where it needs more memory than you have RAM?

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).

Did you time any of these?

> 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?

I wish. Since they were there first, it's hard to get rid of them. (If you're truly masochist, write a PEP and post it to c.l.py to find out how hard. :-)

--Guido van Rossum (home page: http://www.python.org/~guido/)