[vtk-developers] New-style python classes

David Gobbi david.gobbi at gmail.com
Mon Jul 20 11:31:17 EDT 2015


Hi All,

For people who are curious about Python 3 progress, I've created a merge
request that updates the python wrappers so that they use new-style python
classes (one PyTypeObject per wrapped class).  This is the first necessary
step towards Py3K compatibility (it'll still be a month or so before you'll
be able to use Py3K, however).

https://gitlab.kitware.com/vtk/vtk/merge_requests/436

I've done a lot of work to ensure that the wrappers properly respect the
C++ rules for method overloading.  The concept of method overloading
doesn't exist in Python: every python method has only one signature.  That
means the wrappers are responsible for checking the supplied python
arguments and deciding which C++ overload to call.  To further complicate
the issue, in C++ it is possible for a method to have some signatures that
are static and other signatures that are not (in fact, VTK is full of such
methods).  Python doesn't support this natively, its methods are either
static or not, and the whole concept of a method being static or non-static
according to what arguments are passed is completely foreign to Python.
But for the vtk wrappers this works fine, due to a bunch of custom method
generation code.

If anyone has a chance to try this out, I'd be interested in hearing the
results.  It isn't going to be merged until after the VTK 6.3 release has
branched.

 - David
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtk-developers/attachments/20150720/7e63d54a/attachment.html>


More information about the vtk-developers mailing list