Skip to content

Commit

Permalink
a different alternate of dict.get
Browse files Browse the repository at this point in the history
Pushing this up just to compare the mypy-primer damage as compared
with python#13222. I expect it to be more disruptive, but I'm curious how
much more. It seems similar to but dramatically less disruptive than
an older attempt at changing dict.get in python#10294.
  • Loading branch information
tungol committed Dec 11, 2024
1 parent b076859 commit c6449d7
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
2 changes: 1 addition & 1 deletion stdlib/@tests/stubtest_allowlists/common.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ _collections_abc.AsyncGenerator.ag_frame
_collections_abc.AsyncGenerator.ag_running
asyncio.BaseEventLoop.subprocess_exec # BaseEventLoop adds several parameters and stubtest fails on the difference if we add them
asyncio.base_events.BaseEventLoop.subprocess_exec # BaseEventLoop adds several parameters and stubtest fails on the difference if we add them
builtins.dict.get
# builtins.dict.get
collections\.ChainMap\.fromkeys # https://github.com/python/mypy/issues/17023
configparser.SectionProxy.__getattr__ # SectionProxy can have arbitrary attributes when custom converters are used
configparser.SectionProxy.getboolean # SectionProxy get functions are set in __init__
Expand Down
4 changes: 1 addition & 3 deletions stdlib/builtins.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -1124,9 +1124,7 @@ class dict(MutableMapping[_KT, _VT]):
def fromkeys(cls, iterable: Iterable[_T], value: _S, /) -> dict[_T, _S]: ...
# Positional-only in dict, but not in MutableMapping
@overload # type: ignore[override]
def get(self, key: _KT, /) -> _VT | None: ...
@overload
def get(self, key: _KT, default: _VT, /) -> _VT: ...
def get(self, key: _KT, default: None = None, /) -> _VT | None: ...
@overload
def get(self, key: _KT, default: _T, /) -> _VT | _T: ...
@overload
Expand Down

0 comments on commit c6449d7

Please sign in to comment.