dict.fromkeys supports arbitrary iterables. (#2012)

This should fix #1529.
This commit is contained in:
Matt Gilson
2018-04-03 10:12:04 -04:00
committed by Jelle Zijlstra
parent df55343e60
commit 8e3182dafa

View File

@@ -672,10 +672,10 @@ class dict(MutableMapping[_KT, _VT], Generic[_KT, _VT]):
def items(self) -> ItemsView[_KT, _VT]: ...
@staticmethod
@overload
def fromkeys(seq: Sequence[_T]) -> Dict[_T, Any]: ... # TODO: Actually a class method (mypy/issues#328)
def fromkeys(seq: Iterable[_T]) -> Dict[_T, Any]: ... # TODO: Actually a class method (mypy/issues#328)
@staticmethod
@overload
def fromkeys(seq: Sequence[_T], value: _S) -> Dict[_T, _S]: ...
def fromkeys(seq: Iterable[_T], value: _S) -> Dict[_T, _S]: ...
def __len__(self) -> int: ...
def __getitem__(self, k: _KT) -> _VT: ...
def __setitem__(self, k: _KT, v: _VT) -> None: ...