[IPython-user] completion on record array dtype names

Ville M. Vainio vivainio@gmail....
Thu Dec 20 07:25:37 CST 2007


On Dec 17, 2007 11:15 PM, John Hunter <jdh2358@gmail.com> wrote:

> numpy does not expose the dtype names to tab completion on record
> arrays, in part because Travis has not figure out how he wants to
> handle resolution in case the name clashes with a numpy method, eg
> "mean".  But it should be possible in ipython using a custom completer
> to feed the dtype.names list into the completer if the type is a
> record array.  I am hoping an ipython custom completer guru can help
> me out here.  I would like to bind a custom key, eg CTRL TAB, to
> compete on dtype names, eg something like
>
> if hasattr(obj, 'dtype') and obj.dtype.names is not None:
>     ...complete on obj.dtype.names

So far, custom completers have been implemented for non-python objects
(where string recognition is enough), but this looks like a good
reason to create an additonal custom completer method for python
objects, using simplegeneric (add complete_object generic to
IPython/generics.py, and on python object completer try calling the
complete_object).

I'll add that when I have the time.

-- 
Ville M. Vainio - vivainio.googlepages.com
blog=360.yahoo.com/villevainio - g[mail | talk]='vivainio'


More information about the IPython-user mailing list