[Python-Dev] Re: iterzip()

Barry A. Warsaw barry@zope.com
Mon, 29 Apr 2002 09:30:42 -0400


    [Barry]
    > I'd much rather see a patch that just changed zip() to be an iterator
    > instead of adding an iterzip().  I doubt that much in-field code would
    > break because of it (but write the PEP to find out. ;).

    Gvr> You're brave.  Changing something incompatibly that's been in
    Gvr> the language since 2.1?  I wish you luck though -- zip()
    Gvr> really should have been an interator.

My point was that since zip()'s output seems to be[*] used mostly in
for-loop contexts, the incompatibility is mostly theoretical.  I could
be wrong, or have too small a sample.  This doesn't imply that I
actually think it's worth changing, I don't. ;)  I think most of the
lists operated on by zip() are small enough to fit comfortably in
memory.

-Barry

[*] Quickly audited: Python library, site-packages, Zope3, Mailman.
All but one (not including test suite) were used as the sequence
source in a for-loop or list comp.  One was as an argument to
list.extend().