El dj 26 de 04 del 2007 a les 11:38 -0700, en/na Russell E. Owen va
escriure:
> In converting some code from numarray to numpy I had this:
> isBigendian = (arr.isbyteswapped() != numarray.isBigEndian)
> 
> The only numpy version I've come up with is:
> isBigEndian = (arr.dtype.descr[0][1][0] == '>')

isBigEndian = (arr.dtype.str[0] == '>')

is a little bit shorter. A more elegant approach could be:

isBigEndian = arr.dtype.isnative ^ numpy.little_endian

Cheers,

-- 
Francesc Altet    |  Be careful about using the following code --
Carabos Coop. V.  |  I've only proven that it works, 
www.carabos.com   |  I haven't tested it. -- Donald Knuth

_______________________________________________
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://projects.scipy.org/mailman/listinfo/numpy-discussion

Reply via email to