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 think that Mapping[KT, VT] should be covariant in both KT and VT. The argument for this is that it doesn't have any mutation operations. Mypy might complain (or may eventually start to complain) about having covariant type variables in argument types but in this case it's okay so we can probably just # type: ignore them.
(It wouldn't be safe since somebody can write a get method that actually mutates the mapping, but consenting adults...)
Indeed mypy complains if I make this change, "Cannot use a covariant type variable as a parameter". But adding a # type: ignore works, so I'll do that.
Activity
gvanrossum commentedon Aug 30, 2016
Indeed mypy complains if I make this change, "Cannot use a covariant type variable as a parameter". But adding a
# type: ignoreworks, so I'll do that.Make Mapping covariant.
Make Mapping covariant.
Make Mapping covariant.
Make Mapping covariant. (#512)
Error on invalid type variance for params and returns