Re: [BangPypers] Currying in Python 3.0

2008-12-10 Thread Shekhar
> > Of course, the above can all be done in Python <3.0 using lambda, > but functools.partial makes it look neater. > functools.partial is present in Python 2.5 or above. > Regards > > ___ BangPypers mailing list BangPypers@python.org http://mail.

Re: [BangPypers] Currying in Python 3.0

2008-12-10 Thread Jeff Rush
Anand Balachandran Pillai wrote: > The new functools module in Python provides a neat > API for doing function currying and doing some other > FP tricks. > Of course, the above can all be done in Python <3.0 using lambda, > but functools.partial makes it look neater. I haven't looked at Python

Re: [BangPypers] Currying in Python 3.0

2008-12-10 Thread Anand Balachandran Pillai
On Thu, Dec 11, 2008 at 12:09 PM, Anand Balachandran Pillai <[EMAIL PROTECTED]> wrote: > > So, if you have a function which accepts four arguments, say > curry(curry(f, 10), 20) > curry(curry(curry(f, 10), 20), 30) > curry(curry(curry(curry(f, 10), 20), 30), 40) > def f(a,b,

[BangPypers] Currying in Python 3.0

2008-12-10 Thread Anand Balachandran Pillai
The new functools module in Python provides a neat API for doing function currying and doing some other FP tricks. The functools.partial function allows you to create "partial" functions which chops off an argument from the beginning of the argument list. Simple example. >>> def f(x,y): return x