diff options
| author | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2020-07-09 22:54:14 (GMT) |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-07-09 22:54:14 (GMT) |
| commit | fd27fb7f3dd157294f05bb060f7efd243732ab2d (patch) | |
| tree | debfcb9050bea31dafbe884b68ff0028b2a1e72d /Lib/idlelib/autocomplete.py | |
| parent | c65ee555124a5647b8e3a5d58c906fa5db9e927a (diff) | |
| download | cpython-fd27fb7f3dd157294f05bb060f7efd243732ab2d.zip cpython-fd27fb7f3dd157294f05bb060f7efd243732ab2d.tar.gz cpython-fd27fb7f3dd157294f05bb060f7efd243732ab2d.tar.bz2 | |
bpo-37765: Add keywords to IDLE tab completions (GH-15138)
Keywords are present in the main module tab completion lists generated by rlcompleter, which is used by REPLs on *nix. Add all keywords to IDLE's main module name list except those already added from builtins (True, False, and None) . This list may also be used by Show Completions on the Edit menu, and its hot key.
Rewrite Completions doc.
Co-authored-by: Cheryl Sabella <cheryl.sabella@gmail.com>
(cherry picked from commit bce2eb4646021910aa4074d86f44a09b32d0b2b2)
Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
Diffstat (limited to 'Lib/idlelib/autocomplete.py')
| -rw-r--r-- | Lib/idlelib/autocomplete.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/Lib/idlelib/autocomplete.py b/Lib/idlelib/autocomplete.py index c623d45..e1e9e17 100644 --- a/Lib/idlelib/autocomplete.py +++ b/Lib/idlelib/autocomplete.py @@ -4,6 +4,7 @@ Either on demand or after a user-selected delay after a key character, pop up a list of candidates. """ import __main__ +import keyword import os import string import sys @@ -171,10 +172,13 @@ class AutoComplete: (what, mode), {}) else: if mode == ATTRS: - if what == "": + if what == "": # Main module names. namespace = {**__main__.__builtins__.__dict__, **__main__.__dict__} bigl = eval("dir()", namespace) + kwds = (s for s in keyword.kwlist + if s not in {'True', 'False', 'None'}) + bigl.extend(kwds) bigl.sort() if "__all__" in bigl: smalll = sorted(eval("__all__", namespace)) |
