New submission from Martin Panter:

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

----------
components: Library (Lib)
files: global-dupes.patch
keywords: patch
messages: 254873
nosy: martin.panter
priority: normal
severity: normal
stage: patch review
status: open
title: Make rlcompleter avoid duplicate global names
type: behavior
versions: Python 2.7, Python 3.4, Python 3.5, Python 3.6
Added file: http://bugs.python.org/file41071/global-dupes.patch

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue25663>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to