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

2009-09-21 Thread Jaroslav Hajek
On Fri, Sep 18, 2009 at 10:26 PM, Christopher Barker wrote: > Jaroslav Hajek wrote: string lengths determined >>> c-style null termination >>> >> >> Hmm, this didn't seem to work for me. But maybe I was doing something >> else wrong. Thanks. > > well, I notice that for a length-n string, if t

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

2009-09-18 Thread Christopher Barker
Jaroslav Hajek wrote: >>> string lengths determined >> c-style null termination >> > > Hmm, this didn't seem to work for me. But maybe I was doing something > else wrong. Thanks. well, I notice that for a length-n string, if there are n "real' characters, then there is no null, so that may have

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

2009-09-18 Thread Jaroslav Hajek
On Fri, Sep 18, 2009 at 7:08 PM, Christopher Barker wrote: > Jaroslav Hajek wrote: > >> 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? > > yes. > >> string lengths determi

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

2009-09-18 Thread Christopher Barker
Jaroslav Hajek wrote: > 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? yes. > string lengths determined c-style null termination > Finally, is there any way to create a

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

2009-09-18 Thread Jaroslav Hajek
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 s