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

Darren Dale dsdale24 at gmail.com
Tue Feb 3 09:03:30 EST 2009

On Mon, Feb 2, 2009 at 4:06 PM, Darren Dale <dsdale24 at gmail.com> wrote:

> On Mon, Feb 2, 2009 at 8:07 AM, Ville M. Vainio <vivainio at gmail.com>wrote:
>> On Sun, Feb 1, 2009 at 2:13 AM, Darren Dale <dsdale24 at gmail.com> wrote:
>> > Thank you for the advice. I've been looking at this most of the day, and
>> I
>> > think I'm stuck. I have an object I'm trying to navigate:
>> > It's not clear to me how I would get the object at level_3 and then hook
>> > into ipython's usual completion chain to filter attributes with leading
>> > underscores, or the traits completer, for example. Is this possible?
>> You just need to eval the whole thing, and see what attributes that
>> eval'ed object has. That's what I did in ipy_greedycompleter. It's
>> sort of "complete at your own risk" scheme, but it's the best thing
>> you can get without putting in lots of work (and it will do what you
>> want anyhow). The only work you need to do is determine how much you
>> need to eval (here, it's everything before period).
> Thanks for the suggestion. Once I determine how much to eval, do you know
> if it is possible to hook back into the standard completer pipeline to
> benefit from things like ipy_traits_completer?

I'd like to make a suggestion for the regular expression in the greedy
completer. Prepending  r"(?:.*\=+)?" should allow you to do things like:


since it won't include a=b= in the match.

I'm making progress on a custom completer for a dict-like object that doesnt
call arbitrary functions (regular expressions are a pain to relearn, but
they are incredibly useful). I'll share what I have as soon as I tie what I
have together.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ipython-dev/attachments/20090203/46399217/attachment.html>

More information about the IPython-dev mailing list