[Numpy-discussion] Changing byte ordering with astype fails with 0d arrays
Travis Oliphant
oliphant.travis at ieee.org
Mon Sep 18 15:01:19 EDT 2006
Matthew Brett wrote:
> Hi,
>
> As expected:
>
> In [67]:a = array([1], dtype='<i4')
>
> In [68]:a.astype('>i4').dtype
> Out[68]:dtype('>i4')
>
> I was also expecting this to work for 0d arrays, but it doesn't:
>
> In [69]:a = array(1, dtype='<i4')
>
> In [70]:a.astype('>i4').dtype
> Out[70]:dtype('<i4')
>
>
The problem is that the astype method is returning an array scalar (it
used to be that 0-d arrays were "avoided" at all costs). We've since
relaxes this requirement and I think here's another place where it needs
to be relaxed.
-Travis
More information about the NumPy-Discussion
mailing list