[Numpy-discussion] Strange behavior of operator *=
François Steinmetz
francois.steinmetz at gmail.com
Tue Apr 5 05:49:13 EDT 2011
Hi all,
I have encountered the following strangeness :
>>> from numpy import *
>>> __version__
'1.5.1'
>>> a = eye(2, dtype='int')
>>> a *= 1.0
>>> a ; a.dtype
array([[1, 0],
[0, 1]])
dtype('int64')
>>> a = a * 1.0
>>> a ; a.dtype
array([[ 1., 0.],
[ 0., 1.]])
dtype('float64')
So, in this case "a *= x" is not equivalent to "a = a*x" ?
François
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20110405/5ca6e506/attachment.html>
More information about the NumPy-Discussion
mailing list