[Numpy-discussion] dtype subarray comparison
Mark Wiebe
mwwiebe at gmail.com
Thu Oct 21 17:25:24 EDT 2010
On Thu, Oct 21, 2010 at 2:11 PM, Pauli Virtanen <pav at iki.fi> wrote:
> <snip>
>
> Also, it is not correct to assume the dimensions are added to the end:
>
> >>> x = np.zeros((2,3),dtype=[('a','f8',(4,))]).T
> >>> x.shape
> (3, 2)
> >>> x['a'].shape
> (4, 3, 2)
>
> There's a special branch in the field access code that does this for
> Fortran-order arrays. Or, more precisely, arrays with the fortran-order
> flag set. (IIRC, there are some ways to create arrays in Fortran order so
> that the flag does not get set.)
>
> This seems to be somewhat of a mis-feature to me -- it makes predicting
> code behavior difficult to anticipate.
>
That sounds like it could be tricky to handle correctly, especially since it
should probably work to compare Fortran-order arrays with non-Fortran ones.
Does anything actually depend on this behavior? Maybe it's something that
could change?
-Mark
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20101021/0e0b61ca/attachment.html>
More information about the NumPy-Discussion
mailing list