On Wed, 23 Nov 2005 09:54:46 +0100, "Fredrik Lundh" <[EMAIL PROTECTED]> wrote:
>Bengt Richter wrote: > >> >Though it looks nice, it's an implementation dependant solution. What if >> >someone changes zip to fetch the second item first? >> >> That would be a counter-intuitive thing to do. Most things go left->right >> in order as the default assumption. > >it's not only the order that matters, but also the number of items >read from the source iterators on each iteration. > Not sure I understand. Are you thinking of something like lines from a file, where there might be chunky buffering? ISTM that wouldn't matter if the same next method was called. Here we have multiple references to the same iterator. Isn't e.g. buiding a plain tuple defined with evaluation one element at a time left to right? So an iterator it = xrange(4) can't know that it's being used in a context like (it.next(), it.next()), so why should zip be any different? Zip _is_ building tuples after all, and it's perfectly clear where they are coming from (or am I missing something?) Why not left to right like a normal tuple? Regards, Bengt Richter -- http://mail.python.org/mailman/listinfo/python-list