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_names dict there can be converted into a frozendict.
This 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:
def has_key(ch):
if isinstance(ch, str):
ch = ord(ch)
# Figure out the correct capability name for the keycode.
capability_name = _capability_names.get(ch)
if capability_name is None:
return False
This is a very prime example of a use case of frozendict. I will open a PR to close this.
Has this already been discussed elsewhere?
This is a minor feature, which does not need previous discussion elsewhere
Links to previous discussion of this feature:
No response
Linked PRs
Feature or enhancement
Proposal:
The pure python implementation of
curses.has_keymakes use of the has_key sub-module, which has seen no update in 20 years. Now that thefrozendictbuilt-in type has been implemented, the_capability_namesdict there can be converted into afrozendict.This 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_keyfunction here:This is a very prime example of a use case of
frozendict. I will open a PR to close this.Has this already been discussed elsewhere?
This is a minor feature, which does not need previous discussion elsewhere
Links to previous discussion of this feature:
No response
Linked PRs
frozendictin pure python fallback forcurses.has_key#146154