Currying
Comecacahuates opened this issue · 1 comments
Comecacahuates commented
I tried this code for function currying
from fn.func import curried
@curried
def sum5(a, b, c, d, e):
return a + b + c + d + e
sum5(1)(2)(3)(4)(5)
15
sum5(1, 2, 3)(4, 5)
15
but when I call the function I get the following error
Traceback (most recent call last):
File "", line 1, in
File "fn/func.py", line 83, in _curried
return curried(partial(func, _args, *_kwargs))
File "fn/func.py", line 69, in curried
@wraps(func)
File "/usr/lib/python2.7/functools.py", line 33, in update_wrapper
setattr(wrapper, attr, getattr(wrapped, attr))
AttributeError: 'functools.partial' object has no attribute 'module'