mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-08 04:54:47 +08:00
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.
This commit is contained in:
committed by
Jelle Zijlstra
parent
0386f3daec
commit
ebea29a0ed
@@ -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: ...
|
||||
|
||||
Reference in New Issue
Block a user