Terry J. Reedy <[email protected]> added the comment:
If keywords are included when the REPL has tab completions (which Windows
doesn't), then it is plausible that IDLE should. It could be considered part
of 'Shell should (mostly) imitate REPL'. But I can see Tal's point, though the
relative expansion is pretty small. And there is nothing on the master
completions issue #27609 where I collected known not-yet-rejected suggestions
and ideas.
The implementation is trivial. Add two new lines to autocomplete.py. So you
can easily patch a private copy. I am preparing a minimal PR.
import keyword # add
...
def fetch_completions(self, what, mode):
...
bigl = eval("dir()", namespace)
bigl.extend(keyword.kwlist) # add
bigl.sort()
True, False, and None are also in builtins, so cannot serve as a test.
---
A separate idea: annotate completion list, at least as an option, with
'keyword' or class, possibly prefixed with 'built-in', so 'built-in function',
'function', and so on.
----------
nosy: -rhettinger
stage: -> test needed
title: Include keywords in autocomplete list for IDLE -> IDLE: Include keywords
in __main__ autocomplete list
versions: +Python 3.7, Python 3.8
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue37765>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com