[SciPy-dev] Changing return types in C API

Travis Oliphant oliphant at ee.byu.edu
Wed Feb 1 18:28:02 EST 2006


David M. Cooke wrote:

>Sasha <ndarray at mac.com> writes:
>  
>
>I'll look for those. One trouble is the strides member of
>PyArrayObject; it's harder by a bit to apply a stride given in bytes
>to a double * (say). Although this is the same problem that you'd have
>after casting from the char* to the double *.
>  
>

This is the real trouble.  The reason data is a char* is because strides 
is given in bytes.  If we were to change the meaning of strides to 
"elements",  this would break a lot of code that assumes it is given in 
bytes.

Also, there is much more flexibility when strides can be given in terms 
of bytes.  You can define a record with
float, int16 elements, and now the float array can also be defined 
easily using strides.  Of course it is a misaligned array, but that is 
the point of the ALIGNED flag...

-Travis




More information about the SciPy-Dev mailing list