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

@typedispatch does not support default values #60

Closed
antorsae opened this issue Aug 28, 2020 · 3 comments
Closed

@typedispatch does not support default values #60

antorsae opened this issue Aug 28, 2020 · 3 comments

Comments

@antorsae
Copy link

@typedispatch
def f_td_test(x:int, y:int=10): return x*y

test_eq(f_td_test(3,2), 6)
test_eq(f_td_test(3), 30)

Errs out:

---------------------------------------
TypeErrorTraceback (most recent call last)
<ipython-input-34-6e7b98db6be2> in <module>
      3 
      4 test_eq(f_td_test(3,2), 6)
----> 5 test_eq(f_td_test(3), 30)

<ipython-input-12-9fc191b1d495> in __call__(self, *args, **kwargs)
     34         if not f: return args[0]
     35         if self.inst is not None: f = MethodType(f, self.inst)
---> 36         return f(*args, **kwargs)
     37 
     38     def __get__(self, inst, owner):

TypeError: f_td_test() missing 1 required positional argument: 'y'
@jph00
Copy link
Member

jph00 commented Aug 29, 2020

Are you interested enough in this to have a go at fixing it? Because I'm not likely to, unless I really need it... ;)

@antorsae
Copy link
Author

antorsae commented Aug 30, 2020 via email

@jph00
Copy link
Member

jph00 commented Sep 1, 2020

Closing this since we have a workaround.

@jph00 jph00 closed this as completed Sep 1, 2020
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

2 participants