Closures and Partial Function Application

Piet van Oostrum piet at vanoostrum.org
Mon Sep 5 10:23:24 EDT 2011


Travis Parks <jehugaleahsa at gmail.com> writes:

> I also like partial function application. What is the easiest way of
> achieving this in Python? Would it look something like this:
>
> def foo(x, y):
>     return x + y
>
> xFoo = lambda y: foo(10, y)

from functools import partial
xfoo = partial(foo, 10)
-- 
Piet van Oostrum <piet at vanoostrum.org>
WWW: http://pietvanoostrum.com/
PGP key: [8DAE142BE17999C4]



More information about the Python-list mailing list