Currying in Python

Steven D'Aprano steve+comp.lang.python at pearwood.info
Sat Mar 17 02:46:59 CET 2012


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.)



-- 
Steven



More information about the Python-list mailing list