@@ -761,6 +761,11 @@ class ValuesView(MappingView, Collection[_VT_co]):
761761 def __contains__ (self , value : object ) -> bool : ...
762762 def __iter__ (self ) -> Iterator [_VT_co ]: ...
763763
764+ # note for Mapping.get and MutableMapping.pop and MutableMapping.setdefault
765+ # In _collections_abc.py the parameters are positional-or-keyword,
766+ # but dict and types.MappingProxyType (the vast majority of Mapping types)
767+ # don't allow keyword arguments.
768+
764769class Mapping (Collection [_KT ], Generic [_KT , _VT_co ]):
765770 # TODO: We wish the key type could also be covariant, but that doesn't work,
766771 # see discussion in https://github.com/python/typing/pull/273.
@@ -770,9 +775,9 @@ class Mapping(Collection[_KT], Generic[_KT, _VT_co]):
770775 @overload
771776 def get (self , key : _KT , / ) -> _VT_co | None : ...
772777 @overload
773- def get (self , key : _KT , / , default : _VT_co ) -> _VT_co : ... # type: ignore[misc] # pyright: ignore[reportGeneralTypeIssues] # Covariant type as parameter
778+ def get (self , key : _KT , default : _VT_co , / ) -> _VT_co : ... # type: ignore[misc] # pyright: ignore[reportGeneralTypeIssues] # Covariant type as parameter
774779 @overload
775- def get (self , key : _KT , / , default : _T ) -> _VT_co | _T : ...
780+ def get (self , key : _KT , default : _T , / ) -> _VT_co | _T : ...
776781 def items (self ) -> ItemsView [_KT , _VT_co ]: ...
777782 def keys (self ) -> KeysView [_KT ]: ...
778783 def values (self ) -> ValuesView [_VT_co ]: ...
@@ -788,9 +793,9 @@ class MutableMapping(Mapping[_KT, _VT]):
788793 @overload
789794 def pop (self , key : _KT , / ) -> _VT : ...
790795 @overload
791- def pop (self , key : _KT , / , default : _VT ) -> _VT : ...
796+ def pop (self , key : _KT , default : _VT , / ) -> _VT : ...
792797 @overload
793- def pop (self , key : _KT , / , default : _T ) -> _VT | _T : ...
798+ def pop (self , key : _KT , default : _T , / ) -> _VT | _T : ...
794799 def popitem (self ) -> tuple [_KT , _VT ]: ...
795800 # This overload should be allowed only if the value type is compatible with None.
796801 #
0 commit comments