[Cython] Question on Efficient Indexing

T J tjhnson at gmail.com
Tue Sep 2 08:05:50 CEST 2008


I was reading:  http://wiki.cython.org/tutorials/numpy

and I am confused on the difference between:

A)

cimport numpy as np
cdef np.ndarray h = np.zeros([xmax, ymax], dtype=DTYPE)

and

B)

cimport numpy as np
cdef np.ndarray[DTYPE_t, ndim=2] h =np.zeros([xmax, ymax], dtype=DTYPE)


In particular, I guess I don't understand what is gained by using A.
I had thought that the cimport of numpy and the cdef h would be enough
to give significant benefits.  From the article, I understand what B
improves upon over A, but what does A give us in the first place?


More information about the Cython-dev mailing list