You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello!
I saw many discussions about MyPy friendly dispatching. But none of them answer the question:
how to dispatch a function with variable number of positional arguments s.t. MyPy wont blame on it ?
i saw this issue
and the instruction here
but there are equal number of arguments in overloaded methods and one needs to type annotate all of them in "dispatch". whereas in my case i have variable number of args in methods. So the final "dispatch" method can not handle this.
If i do not annotate any args in final "dispatch" method, MyPy also blames
for example:
from plum import dispatch, overload
@overload
def f(x: int) -> int:
return x + 1
@overload
def f(x: str) -> str:
return x
@overload
def f(x: str, y: str) -> str:
return x + y
@dispatch
def f(x):
raise NotImplementedError
Sorry, maybe i skipped an answer somehow, but is there a solution ?
The text was updated successfully, but these errors were encountered:
Hello!
I saw many discussions about MyPy friendly dispatching. But none of them answer the question:
how to dispatch a function with variable number of positional arguments s.t. MyPy wont blame on it ?
i saw this issue
and the instruction here
but there are equal number of arguments in overloaded methods and one needs to type annotate all of them in "dispatch". whereas in my case i have variable number of args in methods. So the final "dispatch" method can not handle this.
If i do not annotate any args in final "dispatch" method, MyPy also blames
for example:
Sorry, maybe i skipped an answer somehow, but is there a solution ?
The text was updated successfully, but these errors were encountered: