From 196f69b27e4353b07372a6641903e6d7fe4b330f Mon Sep 17 00:00:00 2001 From: Akuli Date: Mon, 20 Sep 2021 14:52:41 +0300 Subject: [PATCH] dict.__init__: support dict(string.split(sep) for string in iterable) (#6050) --- stdlib/builtins.pyi | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/stdlib/builtins.pyi b/stdlib/builtins.pyi index 274e227a3..fe8b35ac5 100644 --- a/stdlib/builtins.pyi +++ b/stdlib/builtins.pyi @@ -812,6 +812,10 @@ class dict(MutableMapping[_KT, _VT], Generic[_KT, _VT]): def __init__(self, map: SupportsKeysAndGetItem[_KT, _VT], **kwargs: _VT) -> None: ... @overload def __init__(self, iterable: Iterable[Tuple[_KT, _VT]], **kwargs: _VT) -> None: ... + # Next overload is for dict(string.split(sep) for string in iterable) + # Cannot be Iterable[Sequence[_T]] or otherwise dict(["foo", "bar", "baz"]) is not an error + @overload + def __init__(self: dict[str, str], iterable: Iterable[list[str]]) -> None: ... def __new__(cls: Type[_T1], *args: Any, **kwargs: Any) -> _T1: ... def clear(self) -> None: ... def copy(self) -> dict[_KT, _VT]: ...