With this PR #14574, the previous Mapping annotation for the internal mapping attribute of KeysView seems to have been changed to a Viewable protocol:
# Suitable for dictionary view objects
class Viewable(Protocol[_T_co]):
def __len__(self) -> int: ...
def __iter__(self) -> Iterator[_T_co]: ...
I was comparing this against CPython's collections.abc
class KeysView(MappingView, Set):
__slots__ = ()
@classmethod
def _from_iterable(cls, it):
return set(it)
def __contains__(self, key):
return key in self._mapping
def __iter__(self):
yield from self._mapping
and it appears that self._mapping has now lost the __contains__ (which was previously guaranteed by Mapping). Wanted to raise it here.
With this PR #14574, the previous
Mappingannotation for the internal mapping attribute ofKeysViewseems to have been changed to aViewableprotocol:I was comparing this against CPython's collections.abc
and it appears that
self._mappinghas now lost the__contains__(which was previously guaranteed byMapping). Wanted to raise it here.