Issue25663
Created on 2015-11-19 02:14 by martin.panter, last changed 2022-04-11 14:58 by admin. This issue is now closed.
| Files | ||||
|---|---|---|---|---|
| File name | Uploaded | Description | Edit | |
| global-dupes.patch | martin.panter, 2015-11-19 02:14 | review | ||
| Messages (5) | |||
|---|---|---|---|
| msg254873 - (view) | Author: Martin Panter (martin.panter) * | Date: 2015-11-19 02:14 | |
When playing with the Editline alternative to Readline, I noticed that “global” name completions can include duplicates: >>> No None NotADirectoryError( NotImplementedError( None NotImplemented >>> None None None It completed my line to “None”, but if you hit Tab again, it lists two duplicate options both identical to what I already have. The reason is that “None” is both a reserved keyword, and a member of the builtins module. My patch avoids adding extra completions if a name has already been added. It also prioritizes the global namespace over builtins, so that say if you alias “int” to a non-callable, it is no longer listed with an opening bracket “(” suffix. Earlier behaviour: >>> int = 81 >>> in in input( int int( Now: >>> in in input( int |
|||
| msg254882 - (view) | Author: Serhiy Storchaka (serhiy.storchaka) * | Date: 2015-11-19 07:57 | |
Nice work.
An alternative approach is to make "matches" a dict. And instead of
if match not in seen:
seen.add(word)
matches.append(match)
use just
matches[word] = match
I don't know what approach is better.
Added other minor comments on Rietveld.
|
|||
| msg255238 - (view) | Author: Roundup Robot (python-dev) | Date: 2015-11-24 00:40 | |
New changeset 4799615f4f26 by Martin Panter in branch '3.4': Issue #25663: Make rlcompleter avoid duplicate global names https://hg.python.org/cpython/rev/4799615f4f26 New changeset 4ed70c568baf by Martin Panter in branch '3.5': Issue #25663: Merge rlcompleter fix from 3.4 into 3.5 https://hg.python.org/cpython/rev/4ed70c568baf New changeset 96fb9daf64a5 by Martin Panter in branch 'default': Issue #25663: Merge rlcompleter fix from 3.5 https://hg.python.org/cpython/rev/96fb9daf64a5 New changeset f742c31491e3 by Martin Panter in branch 'default': Issue #25663: Update rlcompleter test for new 3.6 behaviour https://hg.python.org/cpython/rev/f742c31491e3 |
|||
| msg255239 - (view) | Author: Roundup Robot (python-dev) | Date: 2015-11-24 01:19 | |
New changeset d3a9b055206c by Martin Panter in branch '2.7': Issue #25663: Make rlcompleter avoid duplicate global names https://hg.python.org/cpython/rev/d3a9b055206c |
|||
| msg255243 - (view) | Author: Martin Panter (martin.panter) * | Date: 2015-11-24 02:07 | |
I chose to keep my strategy of using the set. Using a dictionary to hold the matches could mess up the order, although it looks like Readline sorts the matches before displaying them. |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022-04-11 14:58:23 | admin | set | github: 69849 |
| 2016-05-13 12:39:24 | martin.panter | unlink | issue22143 superseder |
| 2016-05-13 12:28:37 | martin.panter | link | issue22143 superseder |
| 2015-11-24 02:07:50 | martin.panter | set | status: open -> closed resolution: fixed messages: + msg255243 stage: patch review -> resolved |
| 2015-11-24 01:19:07 | python-dev | set | messages: + msg255239 |
| 2015-11-24 00:40:33 | python-dev | set | nosy:
+ python-dev messages: + msg255238 |
| 2015-11-19 07:57:07 | serhiy.storchaka | set | messages: + msg254882 |
| 2015-11-19 07:20:43 | serhiy.storchaka | set | nosy:
+ serhiy.storchaka |
| 2015-11-19 02:14:21 | martin.panter | create | |