[Numpy-discussion] Native byteorder representation

Francesc Altet faltet@carabos....
Fri Feb 2 06:57:53 CST 2007


We have been bitten by a small glitch related with the representation of 
native byteorders. Here is an example exposing the problem:

>>> numpy.dtype('<i4').byteorder
>>> numpy.dtype('>i4').newbyteorder('little').byteorder

[the example was run on a little endian machine]

We thought that native byteorder were represented always by a '=', and this is 
true when you create the type from scratch. But, if you create a dtype with a 
different byteorder and then switch to a native one (in this case, 'little') 
the representation of the byteorder changes to '<' instead of '='.

We can live with this, but IMO it would be better if the final representation 
of native byteorders could always be made to read '='.


>0,0<   Francesc Altet     http://www.carabos.com/
V   V   Cárabos Coop. V.   Enjoy Data

More information about the Numpy-discussion mailing list