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

2021-11-03 Thread Alex Waygood
Alex Waygood added the comment: The PR that proposes creating a new utility.py file is mine, linked to https://bugs.python.org/issue45447. Would it make things easier if I split it into two PRs: one adding an empty util.py file, and the other making my proposed changes to support syntax

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

2021-11-03 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- keywords: +patch pull_requests: +27639 stage: test needed -> patch review pull_request: https://github.com/python/cpython/pull/29381 ___ Python tracker

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

2021-11-02 Thread Terry J. Reedy
Terry J. Reedy added the comment: hyperparser.py, line 13, _ASCII_ID_CHARS line 15, _ASCII_ID_FIRST_CHARS, frozenset(string.ascii_letters + "_") Only used on line 18 and 21 to create 128 item lookup tables. The point is to be fast as hyperparser scans multiple chars when invoked. The

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

2021-11-02 Thread Terry J. Reedy
Terry J. Reedy added the comment: editor.py, line 809, IDENTCHARS Used in the immediately following def colorize_syntax_error on line 814. if char and char in self.IDENTCHARS: text.tag_add("ERROR", pos + " wordstart", pos) I believe the intent is to color the part of an

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

2021-11-02 Thread Terry J. Reedy
Terry J. Reedy added the comment: undo.py, line 254, alphanumeric Used in immediately following lines to classify chars as 'alphanumeric', 'newline', or 'punctuation' (the default). I believe I have only ever looked at this module to add the test code at the bottom. In any case, I don't

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

2021-11-02 Thread Terry J. Reedy
Terry J. Reedy added the comment: autocomplete.py, line 33, ID_CHARS is only used on line 137 to find the prefix of an identifier when completions have been explicitly requested. while i and (curline[i-1] in ID_CHARS or ord(curline[i-1]) > 127): i -= 1

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

2021-11-02 Thread Terry J. Reedy
Terry J. Reedy added the comment: autoexpand.py, line 20, wordchars 'wordchars' is correct here since words beginning with digits can be expanded. >>> s = '0x4f334' >>> 0x4f334 # Hit alt-/ after 0 and enter 324404 Used in line 89 in method getprevword while i > 0 and line[i-1] in

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

2021-11-02 Thread Terry J. Reedy
Terry J. Reedy added the comment: There have been occasional discussions about IDLE not being properly unicode aware in some of its functions. Discussions have foundered on these facts and no fix made. 1. The direct replacement string, your 'identcontchars', seems too big. We have

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

2021-11-02 Thread Terry J. Reedy
Terry J. Reedy added the comment: I checked for other possible ascii only problems and only found config_key.py: 14: ALPHANUM_KEYS = tuple(string.ascii_lowercase + string.digits) config_key.py: 39: if 'Shift' in modifiers and key in string.ascii_lowercase: config_key.py: 15:

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

2021-11-02 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: This in an interesting problem. I am going to work on it at the next weekends. -- ___ Python tracker ___

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

2021-11-02 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Complete sets of characters which can be used in identifiers are too large: >>> allchars = ''.join(map(chr, range(0x11))) >>> identstartchars = ''.join(c for c in allchars if c.isidentifier()) >>> identcontchars = ''.join(c for c in allchars if ('a' +

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

2021-11-02 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: This set is mostly outdated. In Python 2 it was a set of characters composing identifiers, but in Python 3 identifiers can contain non-ASCII characters. -- nosy: +serhiy.storchaka ___ Python tracker

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

2021-11-02 Thread Terry J. Reedy
New submission from Terry J. Reedy : 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 =