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
(mypy is a blessing, it has made my programming life far more enjoyable; thank you!)
I am trying to write a generic decorator for a class of functions that take an initial, named argument, followed by arbitrary other arguments. Here's a dummy implementation, showing an "identity" decorator:
Technically mypy is correct, because (str) -> Any is not a subtype of (str, *Any, **Any) -> Any. But it is pretty typical to use *args, **kwargs as a synonym for "don't care". So essentially this is no different than #5876
(
mypy
is a blessing, it has made my programming life far more enjoyable; thank you!)I am trying to write a generic decorator for a class of functions that take an initial, named argument, followed by arbitrary other arguments. Here's a dummy implementation, showing an "identity" decorator:
When I try to use this decorator as follows:
I get the following error from
mypy
:Shouldn't
do_something
be compatible with theVarArg
-ladenCallable
type? If not, what can I do to make this pass typechecking?I also tried using a
Protocol
for this:Replacing the
F = ...
line from above withF = WorkspaceFn
yields this similar error message:The text was updated successfully, but these errors were encountered: