[vtk-developers] Wrapping vtkVariant and other special types in Python

Brad King brad.king at kitware.com
Mon May 3 09:41:38 EDT 2010


David Gobbi wrote:
> It's a new python class, and from python it doesn't look like a native
> type.
[snip]
> Is making it look like a native type a hot item on the wish list?
> Operators are actually parsed by the vtkParse front end, but right now
> the back-ends like vtkWrapPython.c are ignoring them.

I think vtkVariant exists because C++ does not have runtime-typed stack
data out of the box.  Since Python does, vtkVariant is not really needed
for that purpose.  It "would be nice" if python scripts could just pass
their own values and have them automatically converted to vtkVariant
if no other overload is a better/direct match.  I'm not sure this is
practical, but if you have time to investigate this possibility I would
be interested in the results.

> I've added a "WRAP_SPECIAL" property for vtkVariant and vtkTimeStamp.

Good idea.

> In addition to special type support for python and massive cleanup of
> vtkWrapPython.c, I've also changed the way that overloaded functions
> are resolved.  The python wrappers used to try each overload in turn
> until one of them worked.  Now the python wrappers find the overload
> that is the best match to the arguments.

Nice.  How likely is this to change the method selection result?  Might
it affect existing scripts?

I briefly glanced through the changes you've published so far.  Overall
it looks good from a high-level point of view.  I'm not sure when I'll
find time to actually try building it and try out the new wrappers.
I'm still busy preparing our switch to a branchy workflow in Git, which
will be the preferred way for you to publish this work when it's done!

Thanks for your work!
-Brad



More information about the vtk-developers mailing list