[issue13430] Add a curry function to the functools module

Marko Nervo report at bugs.python.org
Fri Nov 18 19:02:55 CET 2011


Marko Nervo <marko at python.it> added the comment:

I totally disagree with the syntax for curried function, but I think a curry function is perfect for the functools module and I also think it could be useful at least as functools.partial. In addition, a lot of languages support currying, such as Haskell, Scala, Javascript...

However, here an example less confusional

>>> adder = curry(lambda (x, y): (x + y))
>>> adder3 = adder(3)
>>> adder3(4)
7
>>> adder3(5)
8

Currying let you defining new functions on other functions. This is a common practice in functional programming (point-free style). So, why not?

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue13430>
_______________________________________


More information about the Python-bugs-list mailing list