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

Darren Dale dsdale24@gmail....
Tue Feb 3 15:13:07 CST 2009


And here is the h5py completer.

On Tue, Feb 3, 2009 at 4:00 PM, Darren Dale <dsdale24@gmail.com> wrote:

> I forgot the most important part. Thank you Ville and Fernando for your
> help.
>
> Darren
>
>
> On Tue, Feb 3, 2009 at 3:59 PM, Darren Dale <dsdale24@gmail.com> wrote:
>
>>
>>
>> On Tue, Feb 3, 2009 at 2:43 PM, Ville M. Vainio <vivainio@gmail.com>wrote:
>>
>>> On Tue, Feb 3, 2009 at 9:25 PM, Darren Dale <dsdale24@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
>> general.
>>
>> Darren
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ipython.scipy.org/pipermail/ipython-dev/attachments/20090203/1835c8ee/attachment.html 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ipy_h5py_completer.py
Type: text/x-python
Size: 2795 bytes
Desc: not available
Url : http://lists.ipython.scipy.org/pipermail/ipython-dev/attachments/20090203/1835c8ee/attachment.py 


More information about the IPython-dev mailing list