kachayev/fn.py

Currying

Comecacahuates opened this issue · 1 comments

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'

Hello,

I have written a pull request dealing with this exact problem #75

However as you can see it has been sitting around for a while. I am not sure if this project is being actively maintain at the moment