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
It looks like a possible solution here is to define a hidden typeshed-only supertype of Mapping (maybe call it _Mapping) that will be covariant in key type. We can then use it to annotate some built-in function and method arguments where we know it is safe.
Most Mutable containers are invariant. You can read more about that in details here: generics. For Dict(Mapping), it has been discussed in detail here. That said, you may try out the Protocol: SupportsItems, to have a covariant mapping of a dictionary.
The text was updated successfully, but these errors were encountered: