Dag Sverre Seljebotn wrote:

> Comment: The only "shady" part here is "contarr.data", which accesses 
> implementation details of NumPy arrays. I'm guessing that this will 
> never change, but I once planned to make a generic cython function 
> "cython.buffer.bufptr" which would return the same pointer but it could 
> be acquired through the buffer API.

The canonical way to avoid accessing .data directly is to use the 
PyArray_DATA() 
macro (returns a void*). Similarly, dimensions and strides can be accessed via 
PyArray_DIMS() and PyArray_STRIDES().

-- 
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
  that is made terrible by our own mad attempt to interpret it as though it had
  an underlying truth."
   -- Umberto Eco

_______________________________________________
Cython-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/cython-dev

Reply via email to