[issue45692] IDLE: define word/id chars in one place.

Terry J. Reedy report at bugs.python.org
Tue Nov 2 12:45:21 EDT 2021


New submission from Terry J. Reedy <tjreedy at udel.edu>:

IDLE currently defines the same set of chars in 5 places with 5 names. (Listed by Serhiy Storchaka in #45669.)
Lib/idlelib/autoexpand.py:20:    wordchars = string.ascii_letters + string.digits + "_"
Lib/idlelib/undo.py:254:    alphanumeric = string.ascii_letters + string.digits + "_"
Lib/idlelib/editor.py:809:    IDENTCHARS = string.ascii_letters + string.digits + "_"
Lib/idlelib/hyperparser.py:13:_ASCII_ID_CHARS = frozenset(string.ascii_letters + string.digits + "_")
Lib/idlelib/autocomplete.py:33:ID_CHARS = string.ascii_letters + string.digits + "_"

I suspect that either a string or frozenset would work everywhere (check).  I will pick a name after checking this.  The single definition would go in the proposed utils.py, which is part of another issue and PR.

(Note: the utility tk index functions should also go there.)

----------
assignee: terry.reedy
components: IDLE
messages: 405516
nosy: terry.reedy
priority: normal
severity: normal
stage: test needed
status: open
title: IDLE: define word/id chars in one place.
type: enhancement
versions: Python 3.11

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue45692>
_______________________________________


More information about the Python-bugs-list mailing list