Re: [Numpy-discussion] Accessing data buffers in numpy scalars

2006-10-17 Thread Travis Oliphant
Lisandro Dalcin wrote: >On 10/17/06, Travis Oliphant <[EMAIL PROTECTED]> wrote: > > >>Or you can use the Python C-API >> >>const char *buffer; >>Py_ssize_t buflen; >> >>PyObject_AsReadBuffer(scalar, (const void **)&buffer, &buflen) >> >>to retrieve a pointer to the data in buffer and the size of

Re: [Numpy-discussion] Accessing data buffers in numpy scalars

2006-10-17 Thread Lisandro Dalcin
On 10/17/06, Travis Oliphant <[EMAIL PROTECTED]> wrote: > Or you can use the Python C-API > > const char *buffer; > Py_ssize_t buflen; > > PyObject_AsReadBuffer(scalar, (const void **)&buffer, &buflen) > > to retrieve a pointer to the data in buffer and the size of the data in > buflen. > Travis.

Re: [Numpy-discussion] Accessing data buffers in numpy scalars

2006-10-17 Thread Francesc Altet
A Dimarts 17 Octubre 2006 18:22, Travis Oliphant va escriure: > >2.- Fetch the buffer in scalartype.data and use the buffer protocol in > > order to access the pointer to data in memory. However, I lack experience > > in buffer protocol, so suggestions for achieving this are welcome. > > This will

Re: [Numpy-discussion] Accessing data buffers in numpy scalars

2006-10-17 Thread Travis Oliphant
Francesc Altet wrote: >Hi, > >I'm looking for an easy way to access the data area of the numpy scalars no >matter its type. I've seen that numpy/arrayscalars.h define a structure for >each scalar type, so I'd guess that it will not be possible to find a general >way for accessing the data buff

[Numpy-discussion] Accessing data buffers in numpy scalars

2006-10-17 Thread Francesc Altet
Hi, I'm looking for an easy way to access the data area of the numpy scalars no matter its type. I've seen that numpy/arrayscalars.h define a structure for each scalar type, so I'd guess that it will not be possible to find a general way for accessing the data buffer for each type. So, I've de