From ebea29a0edd36fa37a29d6ca447ffe86bfccd161 Mon Sep 17 00:00:00 2001 From: Matt Gilson Date: Sat, 18 Aug 2018 22:22:15 -0400 Subject: [PATCH] Make defaultdict.default_factory Optional. (#2401) The API allows for setting this to `None`. It makes the defaultdict behave more like a regular dict. Fixes #2375. --- stdlib/3/collections/__init__.pyi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stdlib/3/collections/__init__.pyi b/stdlib/3/collections/__init__.pyi index ab358e229..d8fdbda97 100644 --- a/stdlib/3/collections/__init__.pyi +++ b/stdlib/3/collections/__init__.pyi @@ -305,7 +305,7 @@ class OrderedDict(Dict[_KT, _VT], Reversible[_KT], Generic[_KT, _VT]): _DefaultDictT = TypeVar('_DefaultDictT', bound=defaultdict) class defaultdict(Dict[_KT, _VT], Generic[_KT, _VT]): - default_factory = ... # type: Callable[[], _VT] + default_factory = ... # type: Optional[Callable[[], _VT]] @overload def __init__(self, **kwargs: _VT) -> None: ...