[Python-ideas] Calling a function of a list without accumulating results

Fred Drake fdrake at acm.org
Thu Sep 27 20:05:48 CEST 2007

On Sep 27, 2007, at 1:02 PM, Arnaud Delobelle wrote:
> def exhaust(iterable):
>    for i in iterable: pass
> Then you can write:
> exhaust(f(x) for x in mylist)

Ooooh... I like this!  Anyone who needs such a construct can just  
write their own exhaust() function, too, since I see no reason to  
pollute the distribution with this.


Fred Drake   <fdrake at acm.org>

More information about the Python-ideas mailing list