Allow use of kwargs in MutableMapping.update (#252)

Discovered while adding MyPy for code that was implementing
MutableMapping and using the update function like this:

```python
class CaseInsensitiveDict(collections.MutableMapping):
    def __init__(self, data=None, **kwargs):
        # type: (dict, **Any) -> None
        self._store = dict()  # type: dict
        if data is None:
            data = {}
        self.update(data, **kwargs)
```

This commit adds kwargs to MutableMapping to allow this.

Shout out to Tim Abbott for assisting me with this.
This commit is contained in:
Tim Simpson
2016-06-05 20:10:56 -05:00
committed by Guido van Rossum
parent 82b9baed3b
commit ac9ade5374
3 changed files with 6 additions and 6 deletions

View File

@@ -181,9 +181,9 @@ class MutableMapping(Mapping[_KT, _VT], Generic[_KT, _VT]):
def popitem(self) -> Tuple[_KT, _VT]: ...
def setdefault(self, k: _KT, default: _VT = ...) -> _VT: ...
@overload
def update(self, m: Mapping[_KT, _VT]) -> None: ...
def update(self, m: Mapping[_KT, _VT], **kwargs: _VT) -> None: ...
@overload
def update(self, m: Iterable[Tuple[_KT, _VT]]) -> None: ...
def update(self, m: Iterable[Tuple[_KT, _VT]], **kwargs: _VT) -> None: ...
Text = unicode