Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Usefrozendict in Lib/curses/has_key.py #146153

Closed
Labels
stdlibStandard Library Python modules in the Lib/ directorytype-featureA feature request or enhancement
@jonathandung

Description

@jonathandung

Feature or enhancement

Proposal:

The pure python implementation ofcurses.has_key makes use ofthe has_key sub-module, which has seen no update in 20 years. Now that thefrozendict built-in type has been implemented, the_capability_names dict 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 thehas_key functionhere:

defhas_key(ch):ifisinstance(ch,str):ch=ord(ch)# Figure out the correct capability name for the keycode.capability_name=_capability_names.get(ch)ifcapability_nameisNone:returnFalse

This is a very prime example of a use case offrozendict. 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    stdlibStandard Library Python modules in the Lib/ directorytype-featureA feature request or enhancement

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2026 Movatter.jp