Hi,

I am very happy with the cython based extensions I have written to
operate on numpy arrays. I'd like to refactor some code that is in these
functions, putting it into a common cdef function that they can each
call. Something like this:

cdef common_stuff(np.ndarray[double, ndim=2] elements):
    # Tight loop here
    ...

def fun1(np.ndarray[double, ndim=2] elements):
    # Do something
    ...
    common_stuff(elements)

def fun2(np.ndarray[double, ndim=2] elements):
    # Do something different
    ...
    common_stuff(elements)


But I get an error on compilation, that the parser "Expected ']'" where
ndim is defined.

What is the right way to do this?

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

Reply via email to