[IPython-dev] _ipython_key_completions_ has unexpected behaviour

Thomas Kluyver takowl at gmail.com
Wed Jul 27 16:44:06 EDT 2016


The whole completion system is in dire need of an overhaul to make it more
flexible. However, I don't think this is as problematic as it seems - tab
completion is only useful with names of more than a couple of characters,
and then the ambiguity will disppear rapidly.

On 27 July 2016 at 15:00, Ludwig Schwardt <ludwig.schwardt at gmail.com> wrote:

> Hi,
>
> I am very excited about the new custom dict key completer as it
> potentially replaces many lines of brittle code in my libraries dating back
> to before IPython 0.10.
>
> My excitement was tempered when I used it. The following happens on the
> latest master:
>
> In [6]: class A(object):
>    ...:     def _ipython_key_completions_(self):
>    ...:         return ['x', 'y']
>    ...:
>
> In [7]:
>
> In [7]: a = A()
>
> In [8]: a['x
>              x      %xmode
>              %xdel  xrange
>
>
> I expected the list of options to include only strings returned by
> _ipython_key_completions_ but instead it gives the whole shebang of
> filenames, Python keywords, magics, etc.
>
> On inspection of the source it seems that all matchers are used unless a
> custom completer is registered (which is my current setup). Alternatively,
> the merge_completions=False config option will only return the results of
> the first successful matcher but since dict_key_matches is the last matcher
> this will also not help.
>
> I would like dict_key_matches to be the only matcher if
> _ipython_key_completions_ is defined, without resorting to config
> overrides. Am I the only one? :-)
>
> Thanks in advance,
>
> Ludwig
>
>
> _______________________________________________
> IPython-dev mailing list
> IPython-dev at scipy.org
> https://mail.scipy.org/mailman/listinfo/ipython-dev
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ipython-dev/attachments/20160727/b75ad6f3/attachment.html>


More information about the IPython-dev mailing list