Partial Function Application -- Advantages over normal function?

Ian Kelly ian.g.kelly at gmail.com
Tue Jul 19 12:49:00 EDT 2011


On Tue, Jul 19, 2011 at 12:22 AM, Thomas Jollans <t at jollybox.de> wrote:
>> Supplemental: The above can be simplified to
>>
>> def makeadder(y): return lambda x: x + y
>>
>
> In turn:
>
> makeadder = lambda y: lambda x: x + y

That's not an improvement.  lambda is for making anonymous functions.
If you're going to construct a lambda and bind it to a name, you
should just use def.



More information about the Python-list mailing list