[vtk-developers] Problem with Python wrappers

David Gobbi david.gobbi at gmail.com
Fri Jul 15 08:42:42 EDT 2011


Hi Prabhu,

It is not quite as simple as using the name vtkVector2 because then the name
would no longer be unique, since then all template instantiations of
vtkVector2 would share the same name even though they are different classes.

I could make the names alphanumeric _and_ keep their uniqueness by using a
name mangling scheme, at the cost of making the names less human-readable.

As for the names not being in the vtk module, I envisioned that people would
instantiate these template via the new template "objects" that I had
created, and hadn't given enough thought to automatic tools.

Can you email me a script that walks the VTK tree in the way you require, so
that I can easily test different solutions to find one that works with your
code?  I'm not sure that it is still possible to get this changed for the
VTK 5.8 release, but the faster I can make the changes (i.e. the easier it
is for me to test), the greater the likelihood of it getting into the
release.

 - David

On Fri, Jul 15, 2011 at 12:01 AM, Prabhu Ramachandran <
prabhu at aero.iitb.ac.in> wrote:

> Hi,
>
> It has been a while since I pulled from upstream and I had noticed some
> changes by David Gobbi to the Python wrappers. I found one issue that I
> think is important.  The new support for wrapping templates seems rather
> unPythonic to me.  Here is a simple example:
>
> >>> import vtk
> >>> print vtk.vtkVector2i.__bases__
> (<type 'vtkVector2[int32]'>,)
>
> Now the name of the type for this class is actually illegal in Python. This
> causes all kinds of problems when you want to parse the VTK class hierarchy.
>  The trouble is, you cannot find the 'vtkVector2[int32]' in the vtk module
> nor can you instantiate it that way.  This makes the class hierarchy
> actually inconsistent in Python, i.e. you cannot walk up a class inheritance
> tree and replicate that with the vtk module.  Can the base class be simply
> changed to vtkVector2 which can't be instantiated but exists in the vtk
> module.  The name is also perfectly legal.  I would appreciate it if this
> were changed.  Thanks!
>
> regards,
> --
> Prabhu Ramachandran                 http://www.aero.iitb.ac.in/~**prabhu<http://www.aero.iitb.ac.in/%7Eprabhu>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtk-developers/attachments/20110715/acc1db84/attachment.html>


More information about the vtk-developers mailing list