[Numpy-discussion] byteswap() not doing anything !?
jmiller at stsci.edu
Thu Feb 20 11:23:14 CST 2003
Francesc Alted wrote:
>A Dijous 20 Febrer 2003 15:36, Todd Miller va escriure:
>>The current "plan" is that byteswap() and _byteswap() will both behave
>>as _byteswap() does now; i.e., they will be Numeric compatible synonyms.
>>An explict (extra) call to togglebyteorder() will then produce the
>>current behavior. The meaning of _byteorder will be unchanged.
>>Please let me know if you see any snags in the plan.
>Well, I've been doing some tests, and I think I'll be able to produce a
>version of my code that will be compatible with numarray 0.4 and future
>versions (I'm just no using byteswap() at all).
>However, I've detected a side effect on this change: copy() method is
>broken now in CVS:
>In : a=numarray.array([1,2])
>In : a.togglebyteorder()
>In : b=a.copy()
>In : a
>Out: array([16777216, 33554432])
>In : b
>Out: array([1, 2])
>In : a._byteorder
>In : b._byteorder
>so, you don't get a well-behaved copy of original array a in b
>I think the next patch should cure it:
>--- numarray.py Tue Feb 18 16:35:16 2003
>+++ /usr/local/lib/python2.2/site-packages/numarray/numarray.py Thu Feb 20
>@@ -609,6 +609,7 @@
> c._type = self._type
> if self.isbyteswapped():
> return c
More information about the Numpy-discussion