[issue21261] Teach IDLE to Autocomplete dictionary keys

Terry J. Reedy report at bugs.python.org
Sun Sep 20 03:08:04 EDT 2020


Terry J. Reedy <tjreedy at udel.edu> added the comment:

The current patch completes both strings keys and bytes keys mixed together.  I want to challenge this.

0. What is the use case?  The current patch nearly doubles the autocomple code, which handle user actions up to creation of a completion list.  I would prefer smaller.

1. We agreed on completing 'string keys'. Bytes are not strings.  Bytes might represent an encoded string, but might instead be anything else.  Some bytes are represented by ascii chars, but the majority need hex escapes.

2. Including bytes forces quoting keys in the list box in order to add the 'b' prefix for bytes.  I said above that we should quote anyway, but that was before working with the implementation and discovering the resulting usage issues.

3. Including bytes makes it harder to select a key by typing a partial key.  Suppose d had hundreds of key, a to z.  One want to select 'zeta13  c3'.
>>> d[ <pause> opens a list box with starting with the 'a' words.
One enters 'z'.  Nothing happens because no entry starts with 'a'.
Backspace, enter "'z".  Nothings happens because the default quote used in the listbox is '"'.  If 'b' did not possibly represent a bytes prefix, we could either remove surrounding quotes or ignore them when matching.

----------
versions: +Python 3.10 -Python 3.7

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue21261>
_______________________________________


More information about the Python-bugs-list mailing list