diff options
author | Raymond Hettinger <python@rcn.com> | 2014-03-30 04:01:50 (GMT) |
---|---|---|
committer | Raymond Hettinger <python@rcn.com> | 2014-03-30 04:01:50 (GMT) |
commit | 40e95dfcaafb71a195e5e3bd26f5a832edb34446 (patch) | |
tree | a9d239af08a6109a202891d8d0df8e01a025a48a /Lib/idlelib | |
parent | 3708349c07d79afb4b3f28fab96210bacff555eb (diff) | |
download | cpython-40e95dfcaafb71a195e5e3bd26f5a832edb34446.zip cpython-40e95dfcaafb71a195e5e3bd26f5a832edb34446.tar.gz cpython-40e95dfcaafb71a195e5e3bd26f5a832edb34446.tar.bz2 |
Issue #21029: IDLE now colors print consistently as a keyword.
Diffstat (limited to 'Lib/idlelib')
-rw-r--r-- | Lib/idlelib/ColorDelegator.py | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/Lib/idlelib/ColorDelegator.py b/Lib/idlelib/ColorDelegator.py index c74865d..4838c44 100644 --- a/Lib/idlelib/ColorDelegator.py +++ b/Lib/idlelib/ColorDelegator.py @@ -16,6 +16,9 @@ def make_pat(): kw = r"\b" + any("KEYWORD", keyword.kwlist) + r"\b" builtinlist = [str(name) for name in dir(__builtin__) if not name.startswith('_')] + # We don't know whether "print" is a function or a keyword, + # so we always treat is as a keyword (the most common case). + builtinlist.remove('print') # self.file = file("file") : # 1st 'file' colorized normal, 2nd as builtin, 3rd as string builtin = r"([^.'\"\\#]\b|^)" + any("BUILTIN", builtinlist) + r"\b" |