[Numpy-discussion] Pointers to arrays in C
Tue Jun 3 14:25:29 CDT 2008
Thanks for the fast responses!
> data. Storing bare pointers in the C side and not holding a
> reference to the object providing the data in the C side is really
> error prone.
It's true, I don't do it because I have to process a large number of arrays, and each has thousands of elements; so I tried to avoid making copies because it'd make it slow.
> another option is that you could increase the reference count to
> that array in your C code (Py_INCREF). Then it would not be
> destroyed on the Python side. However, you'd have to make sure you
> Py_DECREF it when you don't need it anymore.
Thanks for the suggestion, I didn't know that was possible; I'm new to python.
Join Excite! - http://www.excite.com
The most personalized portal on the Web!
More information about the Numpy-discussion