Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

curried decorator does not work with type annotations #97

Open
phelps-sg opened this issue Apr 19, 2023 · 0 comments
Open

curried decorator does not work with type annotations #97

phelps-sg opened this issue Apr 19, 2023 · 0 comments

Comments

@phelps-sg
Copy link

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant