Title: Use `frozendict` in Lib/curses/has_key.py · Issue #146153 · python/cpython · GitHub
Open Graph Title: Use `frozendict` in Lib/curses/has_key.py · Issue #146153 · python/cpython
X Title: Use `frozendict` in Lib/curses/has_key.py · Issue #146153 · python/cpython
Description: Feature or enhancement Proposal: The pure python implementation of curses.has_key makes use of the has_key sub-module, which has seen no update in 20 years. Now that the frozendict built-in type has been implemented, the _capability_name...
Open Graph Description: Feature or enhancement Proposal: The pure python implementation of curses.has_key makes use of the has_key sub-module, which has seen no update in 20 years. Now that the frozendict built-in type ha...
X Description: Feature or enhancement Proposal: The pure python implementation of curses.has_key makes use of the has_key sub-module, which has seen no update in 20 years. Now that the frozendict built-in type ha...
Opengraph URL: https://github.com/python/cpython/issues/146153
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Use `frozendict` in Lib/curses/has_key.py","articleBody":"# Feature or enhancement\n\n### Proposal:\n\nThe pure python implementation of `curses.has_key` makes use of [the has_key sub-module](https://github.com/python/cpython/blob/main/Lib/curses/has_key.py), which has seen no update in 20 years. Now that the `frozendict` built-in type has been implemented, the `_capability_names` dict there can be converted into a `frozendict`.\n\nThis dict is supposed to map curses keys to terminfo capability names, and seeing as though its name begins with an underscore, it should be considered an implementation detail anyway. No code modifies this dict, the contents of which are only used by the `has_key` function [here](https://github.com/python/cpython/blob/abd5246305655fc09e4e3c668c8ca09a1b0fc638/Lib/curses/has_key.py#L162):\n```python\ndef has_key(ch):\n if isinstance(ch, str):\n ch = ord(ch)\n\n # Figure out the correct capability name for the keycode.\n capability_name = _capability_names.get(ch)\n if capability_name is None:\n return False\n```\n\nThis is a very prime example of a use case of `frozendict`. I will open a PR to close this.\n\n\n### Has this already been discussed elsewhere?\n\nThis is a minor feature, which does not need previous discussion elsewhere\n\n### Links to previous discussion of this feature:\n\n_No response_\n\n\u003c!-- gh-linked-prs --\u003e\n### Linked PRs\n* gh-146154\n\u003c!-- /gh-linked-prs --\u003e\n","author":{"url":"https://github.com/jonathandung","@type":"Person","name":"jonathandung"},"datePublished":"2026-03-19T07:47:41.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":0},"url":"https://github.com/146153/cpython/issues/146153"}
| 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:2f6e94fb-e6c5-c884-959e-4a0fd67b70ab |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | BCEC:309E0A:5F3011:829379:6A50746E |
| html-safe-nonce | 8b5a90044c70ae8a2e886ac68b3704975640fa7ecf856d512321256be1face2c |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCQ0VDOjMwOUUwQTo1RjMwMTE6ODI5Mzc5OjZBNTA3NDZFIiwidmlzaXRvcl9pZCI6IjIzMjY1MzUzODYwNDAzOTg5NTkiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 61940e24f98b264e811d219722402f9b5667df84bc041f364e418990a45a28fa |
| hovercard-subject-tag | issue:4099946679 |
| 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/cpython/146153/issue_layout |
| twitter:image | https://opengraph.githubassets.com/566eeeaed4a80d6dad9e23aac02e981a5a42607701b1a1b056cef47ef34f10c4/python/cpython/issues/146153 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/566eeeaed4a80d6dad9e23aac02e981a5a42607701b1a1b056cef47ef34f10c4/python/cpython/issues/146153 |
| og:image:alt | Feature or enhancement Proposal: The pure python implementation of curses.has_key makes use of the has_key sub-module, which has seen no update in 20 years. Now that the frozendict built-in type ha... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | jonathandung |
| hostname | github.com |
| expected-hostname | github.com |
| None | d6dc8294eb500fa36bbc57472d61fe87c522f9c3c1d64f70f4926f66a66a7efb |
| turbo-cache-control | no-preview |
| go-import | github.com/python/cpython git https://github.com/python/cpython.git |
| octolytics-dimension-user_id | 1525981 |
| octolytics-dimension-user_login | python |
| octolytics-dimension-repository_id | 81598961 |
| octolytics-dimension-repository_nwo | python/cpython |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 81598961 |
| octolytics-dimension-repository_network_root_nwo | python/cpython |
| 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 | 7ac0ad2f2c7e4b9056617355fd9e33e22b0c8df9 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width