diff options
author | kbeldan <kbeldan@users.noreply.github.com> | 2022-05-02 22:36:29 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-05-02 22:36:29 (GMT) |
commit | 4bed9c47bd6c581c4c8ab59ab7acf0e57510d1f7 (patch) | |
tree | ecfcace636dd12cebaaf061d733fa8d2d8fb1ae9 /Lib/rlcompleter.py | |
parent | cc6ae4f4835f9e76a34f24cd1f666c1cc0fecfa3 (diff) | |
download | cpython-4bed9c47bd6c581c4c8ab59ab7acf0e57510d1f7.zip cpython-4bed9c47bd6c581c4c8ab59ab7acf0e57510d1f7.tar.gz cpython-4bed9c47bd6c581c4c8ab59ab7acf0e57510d1f7.tar.bz2 |
gh-92032: Add soft keywords to rlcompleter (#92029)
Let the interpreter autocomplete soft-keywords, ATM the PEP-634 'match'
/ 'case' / '_' (wildcard pattern).
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
Diffstat (limited to 'Lib/rlcompleter.py')
-rw-r--r-- | Lib/rlcompleter.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/Lib/rlcompleter.py b/Lib/rlcompleter.py index 98b7930..4ede6dc 100644 --- a/Lib/rlcompleter.py +++ b/Lib/rlcompleter.py @@ -117,14 +117,14 @@ class Completer: matches = [] seen = {"__builtins__"} n = len(text) - for word in keyword.kwlist: + for word in keyword.kwlist + keyword.softkwlist: if word[:n] == text: seen.add(word) if word in {'finally', 'try'}: word = word + ':' elif word not in {'False', 'None', 'True', 'break', 'continue', 'pass', - 'else'}: + 'else', '_'}: word = word + ' ' matches.append(word) for nspace in [self.namespace, builtins.__dict__]: |