[Python-Dev] itertools module

Raymond Hettinger python@rcn.com
Mon, 27 Jan 2003 17:11:45 -0500


From: "Skip Montanaro" <skip@pobox.com>

>     >> * loopzip() - It's not clear why its next() method should return a
>     >>   list instead of a tuple (again, a seemingly needless distiction
>     >>   with its builtin counterpart, zip()).
> 
>     Raymond> I've wrestled with the one.  The short answer is that zip()
>     Raymond> already does a pretty good job and that the only use for
>     Raymond> loopzip() is super high speed looping.  To that end, reusing a
>     Raymond> single list instead of allocating and building tuples is *much*
>     Raymond> faster.
> 
> How do you know the caller doesn't squirrel away the list you returned on
> the n-th iteration?  I don't see how you can safely reuse the same list.

After more thought, I think loopzip() is too unsavory and taints an
otherwise clean package, so I'll take it out unless someone wants to 
stand-up for it.  Too bad, it was an exceptionally fast solution to the 
lock-step iteration problem.


Raymond