[SciPy-user] passings arrays into C extension

Travis Oliphant oliphant.travis at ieee.org
Fri Dec 2 18:19:33 EST 2005


mike cantor wrote:

>Thanks for the response
>
>newarr = PyArray_From_OF(array, CARRAY_FLAGS);
>dptr = (int *)PyArray_DATA(newarr);
>
>looks like it would do the trick.  Is there a reason to use PyArray_From_OF 
>vs PyArray_ContiguousFromObject?
>  
>
PyArray_ContiguousFromObject is a wrapper around the call I just gave 
you.  So, I don't see any reason to use it as it doesn't support 
arbitrary type arrays.  But, if you don't need those, then it would also 
work (at the price of one extra function call).

-Travis





More information about the SciPy-User mailing list