Python/Numeric users be aware!

Carl carl at never.com
Wed Oct 29 14:09:01 EDT 2008


Confirmed

Benyang wrote:
> Maybe it has been reported somewhere, but it is a big surprise to me.
> 
> # Try the following:
> import Numeric
> a = Numeric.ones(10)
> a[5:] = -1
> print a
> 
> It works correctly on 32-bit linux machines and on 32-bit Windows XP:
> [ 1  1  1  1  1 -1 -1 -1 -1 -1]
> 
> It is totally screwed up on 64-bit linux machines:
> [1 1 1 1 1 1 1 1 1 1]
> 
> # The following works correctly on both 32-bit and 64-bit machines
> (notice the comma):
> a[5:,] *= -1
> 
> The Python version is 2.5.1, and Numeric is the latest version 24.2.



More information about the Python-list mailing list