Partial Function Application -- Advantages over normal function?
Dave Angel
davea at ieee.org
Mon Jul 18 17:45:56 EDT 2011
On 01/-10/-28163 02:59 PM, Terry Reedy wrote:
> On 7/18/2011 8:24 AM, Paul Woolcock wrote:
>> Partial function application (or "currying") is the act of taking a
>> function with two or more parameters, and applying some of the arguments
>> in order to make a new function. The "hello world" example for this
>> seems to be this:
>> <snip>
>
> def makeadder(y)
> def _add(x): return x+y
> add2 = makeadder(2)
>
> <snip>
A couple of typos in that code:
def makeaddr(y):
def _add(x): return x+y
return _add
DaveA
More information about the Python-list
mailing list