[Numpy-discussion] string arrays - accessing data from C++

Jaroslav Hajek highegg at gmail.com
Fri Sep 18 05:35:17 EDT 2009


hi all,

I'm working on Pytave - a Python<->Octave bridge that can either use
NumPy or the older Numeric to map onto Octave's arrays. I would like
to implement support for NumPy's string arrays, but I'm a little
confused about how the data is stored internally.
Does PyArrayObject::data point to a single contiguous char[] buffer,
like with the old Numeric char arrays, with
PyArrayObject::descr->elsize being the maximum length? If yes, how are
string lengths determined (I noticed that the strings stored can have
differing lengths when displayed from the interpreter)?

Finally, is there any way to create an array in NumPy (from within the
interpreter) that would have type == PyArray_CHAR? (There will be no
need for that when I implement the above, I'm just wondering whether I
overlooked something).

Many thanks in advance.

-- 
RNDr. Jaroslav Hajek
computing expert & GNU Octave developer
Aeronautical Research and Test Institute (VZLU)
Prague, Czech Republic
url: www.highegg.matfyz.cz



More information about the NumPy-Discussion mailing list