[Python-Dev] functools.compose to chain functions together
"Martin v. Löwis"
martin at v.loewis.de
Mon Aug 17 00:13:43 CEST 2009
Martin v. Löwis wrote:
>> The reason I came across the old patch was because I was searching
>> for something that did exactly what compose does. That is to say, I
>> had a use case that was compelling enough that I thought there should
>> be something in functools to do what I wanted. I've encountered this
>> pattern often enough that it might be in the stdlib.
> Can you kindly give one or two examples of where compose would have been
I went back in the archives and found your example. What I now don't
understand is why you say that a compose function would be easier to
read than a lambda expression. Can you please elaborate on that?
I deeply believe that it is *harder* to read than a lambda expression,
because the lambda expression makes the evaluation order clear, whereas
the compose function doesn't (of course, function decorators ought to be
commutative, so in this case, lack of clear evaluation order might be
More information about the Python-Dev