On Dec 30, 2005, at 4:35 AM, Jeremy Jones wrote:
[EMAIL PROTECTED] wrote:
This is basically in following form :
a=iter(alist)
zip(a, a, a)
map(None, a , a, a)
The gurus(one of the bot) said that it is very bad in that there
is no
contract saying zip/map would take one element from each iterable, in
that order. There is only contract for the output(tuples, one from
each
iterables). Therefore, it is possible in some future version(though I
very much doubt) that it can be implemented that 4(or whatever
number)
is taken from the iterables at a time, say for optimization purpose.
Seems like worst case, you wind up with a mangling of the ordering.
Actually, worse than that. You could get "a"s (in your example
above) of different sizes. That would be bad. The ordering I can
live with. The variable sizes....not good. Point taken. I doubt
they would do that as well. That would break Python's "few
surprises" idioms.
If you want guarantees, then use itertools.izip or itertools.imap.
Their definitions prevent that kind of (EXTREMELY unlikely)
optimization.
-bob