Title: `KeysView`'s internal mapping no longer expresses `__contains__` · Issue #14884 · python/typeshed · GitHub
Open Graph Title: `KeysView`'s internal mapping no longer expresses `__contains__` · Issue #14884 · python/typeshed
X Title: `KeysView`'s internal mapping no longer expresses `__contains__` · Issue #14884 · python/typeshed
Description: 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__(se...
Open Graph Description: 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 V...
X Description: 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 V...
Opengraph URL: https://github.com/python/typeshed/issues/14884
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"`KeysView`'s internal mapping no longer expresses `__contains__`","articleBody":"With this PR https://github.com/python/typeshed/pull/14574, the previous `Mapping` annotation for the internal mapping attribute of `KeysView` seems to have been changed to a `Viewable` protocol:\n```python\n# Suitable for dictionary view objects\nclass Viewable(Protocol[_T_co]):\n def __len__(self) -> int: ...\n def __iter__(self) -> Iterator[_T_co]: ...\n```\n\nI was comparing this against CPython's collections.abc\n```python\nclass KeysView(MappingView, Set):\n\n __slots__ = ()\n\n @classmethod\n def _from_iterable(cls, it):\n return set(it)\n\n def __contains__(self, key):\n return key in self._mapping\n\n def __iter__(self):\n yield from self._mapping\n```\nand it appears that `self._mapping` has now lost the `__contains__` (which was previously guaranteed by `Mapping`). Wanted to raise it here.\n","author":{"url":"https://github.com/iutlu","@type":"Person","name":"iutlu"},"datePublished":"2025-10-15T15:51:56Z","url":"https://github.com/python/typeshed/issues/14884"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:606f7c5d-7f02-6e75-ecd9-2fb837494fb6 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | C9EA:1BCD46:370294:4A029C:6B00293E |
| html-safe-nonce | dadc6bf68df6ea718129c99cbaeabb22d6028c3edf7883867331dd78a39e99f9 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDOUVBOjFCQ0Q0NjozNzAyOTQ6NEEwMjlDOjZCMDAyOTNFIiwidmlzaXRvcl9pZCI6IjQxODA1OTA2MDUwMTA3NDE1NjYiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | f0359fd1bf36c72dd8d0d9ee48b33e893ccdeb1ac3a773081353f441894c158e |
| hovercard-subject-tag | issue:3518635414 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/python/typeshed/14884/issue_layout |
| twitter:image | https://opengraph.githubassets.com/f2bbdaab910ff695192176887de42fe9498f757f51395d60c6db668e3c6bcef1/python/typeshed/issues/14884 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/f2bbdaab910ff695192176887de42fe9498f757f51395d60c6db668e3c6bcef1/python/typeshed/issues/14884 |
| og:image:alt | 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 V... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | iutlu |
| hostname | github.com |
| expected-hostname | github.com |
| None | 4eb4cba0d69f045374ac15de9666d22b0961e1d555cc3824f36b7734c00c78e0 |
| turbo-cache-control | no-preview |
| go-import | github.com/python/typeshed git https://github.com/python/typeshed.git |
| octolytics-dimension-user_id | 1525981 |
| octolytics-dimension-user_login | python |
| octolytics-dimension-repository_id | 31696383 |
| octolytics-dimension-repository_nwo | python/typeshed |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 31696383 |
| octolytics-dimension-repository_network_root_nwo | python/typeshed |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 44c658b24abf00491fb7ae5f56d42c9f38cbeab2 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width