[Numpy-discussion] numpy.ascontiguousarray on byteswapped data !?

Travis Oliphant oliphant.travis at ieee.org
Thu Aug 10 20:45:10 CDT 2006


Sebastian Haase wrote:
> Hi,
> Does numpy.ascontiguousarray(arr) "fix" the byteorder when arr is non-native 
> byteorder ?
>
> If not, what functions does ?
>   

It can if you pass in a data-type with the right byteorder (or use a 
native built-in data-type).

In NumPy, it's the data-type that carries the "byte-order" 
information.    So, there are lot's of ways to "fix" the byte-order.

Of course there is still the difference between "fixing" the byte-order 
and simply "viewing" the memory in the correct byte-order.  The former 
physically flips bytes around, the latter just flips them on calculation 
and presentation.

-Travis





More information about the Numpy-discussion mailing list