From fcef262a9bdc8af13c720c772c8634e10652f745 Mon Sep 17 00:00:00 2001 From: Jukka Lehtosalo Date: Sun, 17 Apr 2016 13:07:54 +0100 Subject: [PATCH] Support keyword arguments for dict() (Python 2) (#148) --- stdlib/2.7/__builtin__.pyi | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/stdlib/2.7/__builtin__.pyi b/stdlib/2.7/__builtin__.pyi index 1abfaf00f..bc57a3c8b 100644 --- a/stdlib/2.7/__builtin__.pyi +++ b/stdlib/2.7/__builtin__.pyi @@ -514,12 +514,14 @@ class list(MutableSequence[_T], Generic[_T]): def __le__(self, x: List[_T]) -> bool: ... class dict(MutableMapping[_KT, _VT], Generic[_KT, _VT]): + # NOTE: Keyword arguments are special. If they are used, _KT must include + # str, but we have no way of enforcing it here. @overload - def __init__(self) -> None: ... + def __init__(self, **kwargs: _VT) -> None: ... @overload - def __init__(self, map: Mapping[_KT, _VT]) -> None: ... + def __init__(self, map: Mapping[_KT, _VT], **kwargs: _VT) -> None: ... @overload - def __init__(self, iterable: Iterable[Tuple[_KT, _VT]]) -> None: ... # TODO keyword args + def __init__(self, iterable: Iterable[Tuple[_KT, _VT]], **kwargs: _VT) -> None: ... def has_key(self, k: _KT) -> bool: ... def clear(self) -> None: ...