[Numpy-discussion] numpy endian question

Stefan van der Walt stefan at sun.ac.za
Fri Apr 27 08:56:40 EDT 2007


On Fri, Apr 27, 2007 at 08:49:16AM -0400, Christopher Hanley wrote:
> >> -> isBigEndian = (obj.dtype.str[0] == '>')
> >
> > Is this test always safe, even on big endian machines?  Couldn't the
> > dtype.str[0] sometimes be '='?
> >   
> The test does would on big endian machines.  What wouldn't work would be 
> something like this:
> 
> -> isBigEndian = (obj.dtype.byteorder == '>')
> 
> On a big-endian machine you would get '=' in this case.

Ah, yes, I was confused.  What I meant to ask was, couldn't
dtype.str[0] sometimes be '|'?

Cheers
Stéfan



More information about the NumPy-Discussion mailing list