pairs from a list
aisaac at american.edu
Tue Jan 22 17:10:53 CET 2008
Arnaud Delobelle wrote:
> According to the docs , izip is defined to be equivalent to:
> def izip(*iterables):
> iterables = map(iter, iterables)
> while iterables:
> result = [it.next() for it in iterables]
> yield tuple(result)
> This guarantees that it.next() will be performed from left to right,
> so there is no risk that e.g. pairs4([1, 2, 3, 4]) returns [(2, 1),
> (4, 3)].
> Is there anything else that I am overlooking?
>  http://docs.python.org/lib/itertools-functions.html
More information about the Python-list