[Numpy-discussion] how to get data out of an object array in pyrex?
Travis Oliphant
oliphant.travis at ieee.org
Sun Feb 5 20:41:01 EST 2006
Jeff Whitaker wrote:
>
> Hi: I've successfully used the examples at
> http://www.scipy.org/Wiki/Cookbook/Pyrex_and_NumPy to access the data
> in a 'normal' numpy array, but have had no success adapting these
> examples to work with object arrays. I understand that the .data
> attribute holds pointers to the objects which actually contain the
> data in an object array, but how to you use those pointers to get the
> data in C/pyrex?
You have a pointer to a PyObject *object in the data. Thus, data should
be recast to PyObject **. I don't know how to do that in PyRex. But,
it's easy in C.
In C, you will need to be concerned about reference counts. I don't
know how pyrex handles this.
More information about the NumPy-Discussion
mailing list