[IPython-user] completion
Fernando Perez
Fernando.Perez at colorado.edu
Tue Mar 1 23:42:48 CST 2005
Fernando Perez wrote:
> John Hunter wrote:
>
>>I am using the insight toolkit, which is a C++ library with a python
>>wrapper. I find that for certain instances, class methods are
>>available by dir but nothing shows up on tab completion. My get is
>>that there is some getattr magic under the hood that explains this...
>>
>>Is there any way to extend ipython's completion namespace so that it
>>incorporates the information from dir? Where does ipython get the
>>completion namespace from
Mmh, I'm stumped here. I don't have itk, but for vtk I get:
In [5]: reader = vtk.vtkPointSource()
In [6]: reader.
reader.AbortExecuteOff reader.IsA
reader.AbortExecuteOn reader.IsTypeOf
reader.AddObserver reader.Modified
reader.BreakOnError reader.NewInstance
[etc]
I mistakenly said before that Numeric arrays exhibited the same behavior. In
fact, numeric arrays don't report the shape attribute even to a dir() call.
And the completion code (in FlexCompleter.py) _does_ use dir():
expr, attr = m.group(1, 3)
object = eval(expr, self.namespace)
words = dir(object)
etc.
So I have no clue what the problem with itk may be. Perhaps we can play later
with this, I need to release .12 quickly and this is looking like a tricky one.
Best,
f
More information about the IPython-user
mailing list