Iterating over a function call

Terry Reedy tjreedy at udel.edu
Tue Feb 2 00:00:12 CET 2010


On 2/1/2010 3:05 PM, Arnaud Delobelle wrote:

> You have itertools.consume which is close to what you want:
>
>      consume(imap(func, iterable)) # 2.x
>
>      consume(map(func, iterable)) # 3.x

Consume is not in itertools. It is one of many recipes in the doc 
(9.7.2). For exhausting an iterator, collections.deque(iterator, maxlen=0).




More information about the Python-list mailing list