Partial Function Application -- Advantages over normal function?

Thomas Jollans t at jollybox.de
Tue Jul 19 12:58:26 EDT 2011


On 19/07/11 18:49, Ian Kelly wrote:
> 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.

No, it's not an improvement. It's an illustration.



More information about the Python-list mailing list