I am trying to write a currying decorator in python, and I think I\'ve got the general idea down, but still got some cases that aren\'t working right...
def
This one is fairly simple and doesn't use inspect or examine the given function's args
import functools
def curried(func):
"""A decorator that curries the given function.
@curried
def a(b, c):
return (b, c)
a(c=1)(2) # returns (2, 1)
"""
@functools.wraps(func)
def _curried(*args, **kwargs):
return functools.partial(func, *args, **kwargs)
return _curried