[Numpy-discussion] Re: byteswap questions

Travis Oliphant oliphant at ee.byu.edu
Thu Nov 3 12:34:10 CST 2005


Russell E. Owen wrote:

>Cute. isBigEndian doesn't seem to be present in Numeric 23.8. I wonder 
>if it'll be in scipy.core.
>  
>
No, in Numeric the arrays are always assumed to be in machine byte order 
and so sys.byteorder tells all (Numeric.LittleEndian is a Boolean that 
is also defined).

In scipy core, arr.flags.swapped tells you if the bytes are in swapped 
order.

Then,  sys.byteorder or scipy.LittleEndian indicates the machine order.

Or you use the array_interface descriptor.

is_big_endian = (arr.dtypestr[0]  == '>')

-Travis







More information about the Numpy-discussion mailing list