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

Adam Olsen rhamph at gmail.com
Wed Sep 26 23:57:37 CEST 2007

On 9/26/07, Terry Jones <terry at jon.es> wrote:
> What's the most compact way to repeatedly call a function on a list without
> accumulating the results?
> While I can accumulate results via
>     a = [f(x) for x in mylist]
> or with a generator, there doesn't seem to be a way to do this without
> accumulating the results. I guess I need to either use the above and ignore
> the result, or use
>     for x in mylist:
>         f(x)

Just use this.  Simple, readable.  No need to get fancy.

Adam Olsen, aka Rhamphoryncus

More information about the Python-ideas mailing list