a few extensions for the itertools

Mathias Panzenboeck e0427417 at student.tuwien.ac.at
Mon Nov 20 22:01:38 EST 2006


Klaas wrote:
> 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)
> 

Nice! Certainly more beautiful than my version.

> 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.
> 

Yes, got in there by accident.

> -Mike
> 



More information about the Python-list mailing list