[issue37765] IDLE: Include keywords in __main__ autocomplete list

2019-08-10 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

Raymond, since there is no proposal to 'add __main__', I don't understand your 
response.  For the case in question, the completion list continues to be based 
on the keys in __main__.__builtins__.__dict__, and main__.__dict__, as it 
always has been.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue37765] IDLE: Include keywords in __main__ autocomplete list

2019-08-10 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

Since the word "main" is short and since the dunder prefix is common, I don't 
expect to get much value out of adding '__main__'.ISTM, this just increases 
the risk of a false positive for a given dunder method.

> To be clear, I'm currently -1 on this suggestion.

I concur.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue37765] IDLE: Include keywords in __main__ autocomplete list

2019-08-10 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

After more research, I am more inclined to add the keywords to the global 
identifiers list. The IDLE doc says that they should be present.

"Show Completions
 Open a scrollable list allowing selection of keywords and attributes."

If this issue were rejected, the line above would have to be changed.  (Other 
needed updates are another issue.)  It was added to idlelib/help.txt (since 
replaced by help.html) by KBK in

Revision: 209de1f6ca1beaaa6b5eeb413f02e9c8c334ee50
Author: Kurt B. Kaiser 
Date: 2/8/2007 5:58:18 PM
Message: ... Added AutoComplete instructions to IDLE Help.

(I checked 2.6 fetch_completions and keywords were not actually included in the 
global ('') list.)

The completion menu entry was copied to idle.rst in patches for #5066 by 
Jessica McKeller and Todd Rovito.  Both docs were updated.  Another 5 people, 
at least, reviewed, including 3 core developers.  It was committed by a 4th, 
Andrew Svetlov.  So 9 people besides me did not notice the discrepancy and may 
have thought 'keywords, fine', like I have been.

One can invoke Show Completions not following anything to get a list of names 
that one should not use.  For that use, keywords should be included.  This list 
currently has 230+ identifiers, 150+ all lowercase.  keyword.kwlist would add 
32 (35 - 3 builtins).  It is not a huge increase.

--
nosy: +cheryl.sabella
stage: patch review -> test needed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue37765] IDLE: Include keywords in __main__ autocomplete list

2019-08-05 Thread Karthikeyan Singaravelan


Karthikeyan Singaravelan  added the comment:

Thanks Terry, I used a similar patch. My main use case was around typing where 
normal shell autocompletes it and was curious if it was intentional. I didn't 
know that windows didn't give keywords. The keywords are short and added very 
rarely and perhaps the bigger completion list to actual usage might be low 
since no one opened this issue as Tal mentioned I am open to others feedback.

--
nosy: +rhettinger

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue37765] IDLE: Include keywords in __main__ autocomplete list

2019-08-05 Thread Terry J. Reedy


Change by Terry J. Reedy :


--
keywords: +patch
pull_requests: +14876
stage: test needed -> patch review
pull_request: https://github.com/python/cpython/pull/15138

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue37765] IDLE: Include keywords in __main__ autocomplete list

2019-08-05 Thread Terry J. Reedy


Terry J. Reedy  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 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com