Currying in Python

Steven D'Aprano steve+comp.lang.python at pearwood.info
Fri Mar 16 22:14:54 EDT 2012


On Sat, 17 Mar 2012 01:46:59 +0000, Steven D'Aprano wrote:

> On Sat, 17 Mar 2012 02:21:32 +0100, Kiuhnm wrote:
> 
>> Here we go.
> [snip code]
> 
> 
> Have you looked at functools.partial?
> 
> 
> import functools
> new_func = functools.partial(func, ham, spam=23)
> 
> 
> (I am aware that, technically, currying and partial function application
> are not quite the same thing, but it seems to me on a superficial
> reading that your function performs partial function application rather
> than actually currying. But I haven't read it in enough detail to be
> sure.)

Okay, that was an incredibly superficial reading, because on a second 
reading, I can see it's nothing like partial function application. Sorry 
for the noise.



-- 
Steven



More information about the Python-list mailing list