[Numpy-discussion] byteswap() not doing anything !?

Todd Miller jmiller at stsci.edu
Wed Feb 19 12:45:02 CST 2003


Sebastian Haase wrote:

>>>>xx = na.array((1,2,3))
>>>>xx
>>>>        
>>>>
>array([1, 2, 3])
>  
>
>>>>xx.byteswap()
>>>>xx
>>>>        
>>>>
>array([1, 2, 3])
>  
>
>>>>xx.type()
>>>>        
>>>>
>Int32
>
>Hi all,
>I was reading the documentation for array 0.4
>but I get the about results.
>How do I get the bytes swaped like it says in the manual:
>
>numbyteswap()
>   The byteswap method performs a byte swapping 
>   operation on all the elements in the array, 
>   working inplace (i.e. it returns None). 
>   >>> print a
>   [1 2 3]
>   >>> a.byteswap()
>   >>> print a
>   [16777216 33554432 50331648]
>
This is a known bug/incompatability.  The behavior will be changed for 
the next release of numarray.  Right now,  _byteswap() does what you want.

>
>
>Thanks,
>Sebastian
>
>  
>
Todd





More information about the Numpy-discussion mailing list