Hi!
This little snippet of code tricked me (in a more convoluted form). The *=
operator does not change the datatype of the left hand side array. Is this
intentional? It did fool me and throw my results quite a bit off. I always
assumed that 'a *= b' means exactly the same as 'a = a * b' but this is clearly
not the case!
Paul.
++++++++++++++++++
>>> from numpy import *
>>> a = arange(10)
>>> b = linspace(0,1,10)
>>> a
array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9])
>>> b
array([ 0. , 0.11111111, 0.22222222, 0.33333333, 0.44444444,
0.55555556, 0.66666667, 0.77777778, 0.88888889, 1. ])
>>> a * b
array([ 0. , 0.11111111, 0.44444444, 1. , 1.77777778,
2.77777778, 4. , 5.44444444, 7.11111111, 9. ])
>>> a *= b
>>> a
array([0, 0, 0, 1, 1, 2, 4, 5, 7, 9])
_______________________________________________
NumPy-Discussion mailing list
[email protected]
http://mail.scipy.org/mailman/listinfo/numpy-discussion