[Numpy-discussion] Strange behavior of operator *=

Alan G Isaac alan.isaac at gmail.com
Tue Apr 5 09:09:35 EDT 2011


On 4/5/2011 5:49 AM, François Steinmetz wrote:
>  >>> a = eye(2, dtype='int')
>  >>> a *= 1.0
>  >>> a ; a.dtype
> array([[1, 0],
>         [0, 1]])
> dtype('int64')


This in-place (!) multiplication should not change
the dtype of a.  I suspect you did not exactly cut
and paste...

Alan Isaac




More information about the NumPy-Discussion mailing list