This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: builtins colored as keyword at beginning of line
Type: behavior Stage: resolved
Components: IDLE Versions: Python 3.2, Python 3.3
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: terry.reedy Nosy List: Freiddie, ezio.melotti, gpolo, python-dev, roger.serwy, terry.reedy
Priority: normal Keywords: patch

Created on 2009-07-20 21:39 by Freiddie, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
issue6528.patch roger.serwy, 2011-12-21 20:48 review
Messages (5)
msg90742 - (view) Author: (Freiddie) Date: 2009-07-20 21:39
I noticed in that whenever I enter "None" at the beginning of the line
in IDLE 3.1, the word is colored orange (for keywords) rather than
purple. If I insert a space right before the "None", it returns to its
normal purple color (for builtins), so it only seems to occur at the
beginning of a line. The same thing occurs to "True" and "False", but
not "list", "int", etc. This did not occur in 2.6.
msg90750 - (view) Author: Ezio Melotti (ezio.melotti) * (Python committer) Date: 2009-07-21 08:33
In Python 3, True, False and None are keywords, so the orange should be
correct. It should be orange also when you do "foo = True" though.
msg150042 - (view) Author: Roger Serwy (roger.serwy) * (Python committer) Date: 2011-12-21 20:48
The attached patch excludes keywords from the builtin list and corrects the highlighting configuration panel.
msg151339 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2012-01-16 08:23
New changeset 2d4ce2cdd6d4 by Terry Jan Reedy in branch '3.2':
#6528 None, True, False are keywords in 3.x. Patch by Roger Serwy.
http://hg.python.org/cpython/rev/2d4ce2cdd6d4

New changeset 522f07bfa067 by Terry Jan Reedy in branch 'default':
Merge with 3.2 #6528 None, True, False are keywords in 3.x. Patch by R. Serwy.
http://hg.python.org/cpython/rev/522f07bfa067
msg151340 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2012-01-16 08:25
I just realized that there is 'another' reason not to reuse builtin names (other than those usually given): they will be colorized as builtins even if they have no relation to the builtin. Make_pat uses the function any() defined just above (before the builtin, I am sure), so 'any' is colored as if it were the builtin. Within ColorDelegator.py, it is only used within make_pat, so I considered renaming it to anyp or any_pat, but it might be used by some other module that imports ColorDelegator. Another issue.

"name not in keyword.kwlist" could be "name not in {None, True, False}", but those happen to be the first three items in the kwlist, so the time difference would be nil.

Looks good. Tested on 3.2.2 Win7. Applied.
History
Date User Action Args
2022-04-11 14:56:51adminsetgithub: 50777
2012-01-16 08:54:29terry.reedysetassignee: terry.reedy
2012-01-16 08:25:36terry.reedysetstatus: open -> closed
resolution: fixed
messages: + msg151340

stage: patch review -> resolved
2012-01-16 08:23:03python-devsetnosy: + python-dev
messages: + msg151339
2012-01-16 05:32:11ezio.melottisetpriority: low -> normal
nosy: + terry.reedy

stage: patch review
2011-12-21 20:48:27roger.serwysetfiles: + issue6528.patch
versions: + Python 3.2, Python 3.3, - Python 3.1
nosy: + roger.serwy

messages: + msg150042

keywords: + patch
2009-07-21 08:33:50ezio.melottisetnosy: + ezio.melotti
messages: + msg90750
2009-07-20 22:06:27r.david.murraysetpriority: low
nosy: + gpolo
2009-07-20 21:39:28Freiddiecreate