[Cython] array.array and PIL directly ?
Robert
kxroberto at googlemail.com
Wed May 13 16:46:32 CEST 2009
How to deal with Python's array.array directly - as with numpy.pxd
is there a array.pxd ?
When not wanting the numpy overhead in an application, I use
Python's array.array . And entering/exiting Cython I do around
with .buffer_info() etc on Python level so far like:
assert pyarray.typecode=='f' # single float array
cdef unsigned adr, length
adr,length=pyarray.buffer_info()
cdef float* a = <float*>adr
..
.__copy__()
.fromstring()
etc...
somewhat inelegant for frequent usage and with overhead.
Moving around automatic arrays intra Cython code (instead of bare
pointers would be also more easy with auto refcounting ..
didn't find an example online so far. And also not the
corresponding Python object in the Python C-API
Similar Question regarding a good way of using PIL images directly
(without copying) ? Are there examples?
More information about the Cython-dev
mailing list