a few extensions for the itertools

Klaas mike.klaas at gmail.com
Mon Nov 20 17:23:51 EST 2006


Mathias Panzenboeck wrote:

> It's like the . operator in haskell:
>
> fchain(f,g,h) is the same like lambda *args,**kwargs: f(g(h(*args,**kwargs)))

I used this once:

composedfun = lambda arg: reduce(lambda x, f: f(x), funcs, arg)

so I can see the potential need (it is not terribly obvious in short-
or long- form).

If this belongs anywhere, though, it is functools, not itertools.

-Mike




More information about the Python-list mailing list