[IPython-dev] looking for advice on a custom dict-like completer

Darren Dale dsdale24 at gmail.com
Tue Feb 3 15:59:39 EST 2009

On Tue, Feb 3, 2009 at 2:43 PM, Ville M. Vainio <vivainio at gmail.com> wrote:

> On Tue, Feb 3, 2009 at 9:25 PM, Darren Dale <dsdale24 at gmail.com> wrote:
> > I put this at the end of my activate():
> >
> >     import readline
> >     readline.set_completer_delims(" ")
> >
> >
> > but it looks like that is not the right place to put it. It makes
> attribute
> > completion work, but it breaks item completion. Where should it go?
> Actually, it was the right place to put it. I tried the same and it
> broke item completion for me as well. Apparently, you need ' in your
> completer_delims for item completion, and it breaks attribute
> completion. Oh joy.
> You might want to try finding some kind of compromise from:
> - magic completer_delims that will work

completer delims are perfectly mystical to me, I might as will be readiing
linear A.

> - returning something apart from the whole strings. E.g. the string
> after the ' character. This kind of hackery was necessary for
> completion of file names with spaces in them.

I think I am only returning the string after the ' character.

> - Setting completer delims in your completer (!?)

I didn't think this could work, since there is no opportunity to reset the
delims back to the ipython defaults. But I tried it, and it works ok,
sometimes you need to hit tab twice to get a list of possible completions.
Not bad. It would be nice to find a better solution to the delims issue but
I think I'm out of my depth.

I'm attaching what seems to be a working copy. It only works for string
keys, thats all h5py expects and I didnt have time to try to make it more

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ipython-dev/attachments/20090203/eaf63592/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ipy_dict_completer.py
Type: text/x-python
Size: 2668 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/ipython-dev/attachments/20090203/eaf63592/attachment.py>

More information about the IPython-dev mailing list