Accessing data buffers in numpy scalars

Francesc Altet faltet at
Tue Oct 17 11:35:59 CDT 2006

A Dimarts 17 Octubre 2006 18:22, Travis Oliphant va escriure:
> >2.- Fetch the buffer in 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 also work.   A read-only buffer protocol is exported by all
> the scalars.
> will return a buffer object.
> Or you can use the Python C-API
> const char *buffer;
> Py_ssize_t buflen;
> PyObject_AsReadBuffer(scalar, (const void **)&buffer, &buflen)

Oh, this one seems pretty easy, and as a plus, you don't have to book memory 
for copying the data area, so I'll use it.


>0,0<   Francesc Altet
V   V   Cárabos Coop. V.   Enjoy Data

Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo

More information about the Numpy-discussion mailing list