zip broken?

Erik Max Francis max at alcyone.com
Sat Jun 7 19:03:29 EDT 2003


Marek "Baczek" Baczyñski wrote:

> I found a behaviour of zip() which I don't like -- it hangs on
> infinite generators. Consider this code:

zip only works on finite sequences -- if you think about it, it has to;
it's a standalone function (i.e., not a generator itself), so it has to
finish what it's doing before it returns anything.  And since it needs
to read in the whole sequence to rearrange it, it must only work on
finite sequences.

-- 
   Erik Max Francis && max at alcyone.com && http://www.alcyone.com/max/
 __ San Jose, CA, USA && 37 20 N 121 53 W && &tSftDotIotE
/  \ Physics, as we know it, will be over in six months.
\__/  Max Born (1928)




More information about the Python-list mailing list