[Numpy-discussion] (newbie) How can I use NumPy to wrap my C++ class with 2-dimensional arrays?

Raymond de Vries reedev@zonnet...
Mon Aug 3 15:55:22 CDT 2009

Hi Chris,

>> Thanks for the explanation. After having looked at the documentation, I 
>> decided to do my own plain Python c-api implementation.
> That is unlikely to be the best option these days -- it's simply too 
> easy to make a type checking and or reference counting error.
> If SWIG isn't your cup of tea, take a look at Cython or Ctypes -- lower 
> level and more control, but still handle much of the book keeping for you.
> The Cython team is working on better C++ support, though I don't know 
> where they are at with that.
Oops, I guess I didn't express myself clearly enough: I have used plain 
Python c-api (in my case a list of lists for my 2-dimensional arrays) 
for my typemaps. Sorry for the unclearness. Actually because NumPy is 
not my cup of tea... Especially because Matthieu suggested that I should 
convert my data into a contiguous array.

So no matter what I use, either swig, cython, or.. I still have the 
NumPy issue.

Do you, or someone else, see another possibility?


> -Chris

More information about the NumPy-Discussion mailing list