[Python-Dev] PEP 201, zip() builtin

Greg Ewing greg at cosc.canterbury.ac.nz
Fri Jul 28 00:28:47 EDT 2000


bwarsaw at beopen.com (Barry A. Warsaw):

>      An earlier version of this PEP proposed that
>      zip() return a built-in object that performed lazy evaluation
>      using __getitem__() protocol.  This has been strongly rejected
>      by the BDFL in favor of returning a real Python list. If lazy
>      evaluation is desired in the future, the BDFL suggests an xzip()
>      function be added.

Well, in that case I think the BDFL has just shot this
proposal in the foot as far as being a serious solution
to the parallel for loop problem.

I was willing to live with the idea of using zip() instead
of having a proper parallel iteration syntax, as long as
it was implemented lazily. But now it seems I'll have to
use another ugly x-named function all over the place.

How about calling the lazy version tuples(), so we can
say

   for x,y in tuples(a,b):

which ought to be a whack of a load more intuitively
readable than

   for x,y in xzip(a,b):

Greg Ewing, Computer Science Dept, +--------------------------------------+
University of Canterbury,	   | A citizen of NewZealandCorp, a	  |
Christchurch, New Zealand	   | wholly-owned subsidiary of USA Inc.  |
greg at cosc.canterbury.ac.nz	   +--------------------------------------+




More information about the Python-list mailing list