Make dict.fromkeys() a classmethod (which it is). (#604)

This came up in https://github.com/python/mypy/issues/2254.

I don't know why it was previously defined as a staticmethod, perhaps
there was an old mypy issue?
This commit is contained in:
Guido van Rossum
2016-10-14 09:41:26 -07:00
committed by GitHub
parent 5daf552f5b
commit 26dfcb6859
2 changed files with 8 additions and 8 deletions

View File

@@ -529,12 +529,12 @@ class dict(MutableMapping[_KT, _VT], Generic[_KT, _VT]):
def keys(self) -> KeysView[_KT]: ...
def values(self) -> ValuesView[_VT]: ...
def items(self) -> ItemsView[_KT, _VT]: ...
@staticmethod
@overload
def fromkeys(seq: Sequence[_T]) -> Dict[_T, Any]: ... # TODO: Actually a class method
@staticmethod
@classmethod
def fromkeys(cls, seq: Sequence[_T]) -> Dict[_T, Any]: ...
@overload
def fromkeys(seq: Sequence[_T], value: _S) -> Dict[_T, _S]: ...
@classmethod
def fromkeys(cls, seq: Sequence[_T], value: _S) -> Dict[_T, _S]: ...
def __len__(self) -> int: ...
def __getitem__(self, k: _KT) -> _VT: ...
def __setitem__(self, k: _KT, v: _VT) -> None: ...