[IPython-dev] Question about custom completer behavior: terminal vs qt app

Darren Dale dsdale24 at gmail.com
Mon Mar 12 11:15:35 EDT 2012


Hi All,

I maintain a custom completer for the h5py project. The h5py objects
have a dict-like interface, and the completer supports the following:

In  [1]: import h5py
In  [2]: f=h5py.File('foo.h5')
In  [3]: f['<tab>
1
In  [3]: f['1'].<tab>
f['1'].attrs            f['1'].items            f['1'].ref
f['1'].copy             f['1'].iteritems        f['1'].require_dataset
f['1'].create_dataset   f['1'].iterkeys         f['1'].require_group
f['1'].create_group     f['1'].itervalues       f['1'].values
f['1'].file             f['1'].keys             f['1'].visit
f['1'].get              f['1'].name             f['1'].visititems
f['1'].id               f['1'].parent


If I try to do the same with ipython-qtconsole, tab completion works
for the keys, but the attribute completer does not yield a list of
attributes. The attribute completer acts like there are no possible
matches, even the h5py_attr_completer is returning the following list:

[u"f['1'].attrs", u"f['1'].copy", u"f['1'].create_dataset",
u"f['1'].create_group", u"f['1'].file", u"f['1'].get", u"f['1'].id",
u"f['1'].items", u"f['1'].iteritems", u"f['1'].iterkeys",
u"f['1'].itervalues", u"f['1'].keys", u"f['1'].name",
u"f['1'].parent", u"f['1'].ref", u"f['1'].require_dataset",
u"f['1'].require_group", u"f['1'].values", u"f['1'].visit",
u"f['1'].visititems"]
[u"f['1'].attrs", u"f['1'].copy", u"f['1'].create_dataset",
u"f['1'].create_group", u"f['1'].file", u"f['1'].get", u"f['1'].id",
u"f['1'].items", u"f['1'].iteritems", u"f['1'].iterkeys",
u"f['1'].itervalues", u"f['1'].keys", u"f['1'].name",
u"f['1'].parent", u"f['1'].ref", u"f['1'].require_dataset",
u"f['1'].require_group", u"f['1'].values", u"f['1'].visit",
u"f['1'].visititems"]

I guess my question is, is this a bug, or do I need to take a
different approach?

Thanks,
Darren



More information about the IPython-dev mailing list