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
I saw this in real code, although I don't really understand the reason why this is done. Still, even though it's a bit weird, it's legal and I think mypy should allow it:
class Foo:
def __init__(self, a=1, b=2):
self.a = a
self.b = b
Foo(**{})
$ mypy foo.py
foo.py:7: error: Keywords must be strings
Agreed -- the dict could be type-checked here with a context of Mapping[str, Any] and that would make the empty dict have the type Dict[str, Any] rather than Dict[<nothing>, <nothing>].
Activity
gvanrossum commentedon Sep 6, 2018
Agreed -- the dict could be type-checked here with a context of
Mapping[str, Any]and that would make the empty dict have the typeDict[str, Any]rather thanDict[<nothing>, <nothing>].Low priority though.
Fix argument checking on empty dict with double stars (#9629)