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
{{ message }}
Repository navigation
dict.__init__() and dict.update() don't match #6056
In stubs, __init__ has 5 overloads and update() has 3 overloads. But at runtime, dict.update() accepts everything that dict.__init__ accepts. For example:
Allow **kwargs to update() only if the key type is str. I haven't tried this yet and it may run into tricky variance issues. (What if the key type is a Literal over particular strings?)
Activity
Widen MutableMapping.update type
JelleZijlstra commentedon Dec 22, 2021
Concrete changes that could be made are:
.updatetakeSupportsKeysAndGetIteminstead ofMapping(Widen MutableMapping.update type #6653)**kwargstoupdate()only if the key type is str. I haven't tried this yet and it may run into tricky variance issues. (What if the key type is a Literal over particular strings?)