curried decorator does not work with type annotations
phelps-sg opened this issue · 0 comments
phelps-sg commented
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)
Out[6]: 15
@curried
def sum5(a: int, b: int, c: int, d: int, e: int):
return a + b + c + d +e
sum5(1)(2)(3)(4)(5)
Traceback (most recent call last):
File "/home/sphelps/mambaforge/envs/symbiotica-fund/lib/python3.10/site-packages/IPython/core/interactiveshell.py", line 3505, in run_code
exec(code_obj, self.user_global_ns, self.user_ns)
File "<ipython-input-8-e80b0556d52b>", line 1, in <module>
sum5(1)(2)(3)(4)(5)
File "/home/sphelps/mambaforge/envs/symbiotica-fund/lib/python3.10/site-packages/fn/func.py", line 78, in _curried
spec = getargspec(f)
File "/home/sphelps/mambaforge/envs/symbiotica-fund/lib/python3.10/inspect.py", line 1237, in getargspec
raise ValueError("Function has keyword-only parameters or annotations"
ValueError: Function has keyword-only parameters or annotations, use inspect.signature() API which can support them