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
7: error: Argument 1 to "f" has incompatible type "**Dict[str, object]"; expected "int"
Line 7 contains f(**d).
I don't understand why mypy expects int as the type of an argument passed using **: as far as I know, there is no way for a value passed using ** to be captured by an argument declared with *. Even if the passed map contains a key named vargs, its value would still end up in kwargs.
Note that arguments passed with ** are not positional, so the error message stating "Argument 1" is either poorly worded or perhaps the result of the same problem that causes the false positive.
What is confusing to me is that this false positive only occurs if I pass a Dict, not a Mapping. However, Python will create a new dictionary instance for kwargs in either case, so only the key and value types of the expression after ** should matter, I think, not the mapping type.
I'm using mypy 0.650 with Python 3.6.5.
The text was updated successfully, but these errors were encountered:
When I run mypy on the following code:
It reports:
Line 7 contains
f(**d)
.I don't understand why mypy expects
int
as the type of an argument passed using**
: as far as I know, there is no way for a value passed using**
to be captured by an argument declared with*
. Even if the passed map contains a key namedvargs
, its value would still end up inkwargs
.Note that arguments passed with
**
are not positional, so the error message stating "Argument 1" is either poorly worded or perhaps the result of the same problem that causes the false positive.What is confusing to me is that this false positive only occurs if I pass a
Dict
, not aMapping
. However, Python will create a new dictionary instance forkwargs
in either case, so only the key and value types of the expression after**
should matter, I think, not the mapping type.I'm using mypy 0.650 with Python 3.6.5.
The text was updated successfully, but these errors were encountered: