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

Terry Jones terry at jon.es
Thu Sep 27 23:56:38 CEST 2007


Hi Arnaud

| If you want to do it like this, why not do it explicitly:
| 
| def exhaust(iterable):
|    for i in iterable: pass
| 
| Then you can write:
| 
| exhaust(f(x) for x in mylist)

Thanks - that's nice. It also gives me the generality I wanted, which was
the ability to use the full LC/genexp "for..." syntax, which I should have
emphasized more, including in the subject of the thread.

Terry



More information about the Python-ideas mailing list