[Numpy-discussion] wrong casting of augmented assignment statements

Robert Kern robert.kern at gmail.com
Tue Jan 12 13:09:05 EST 2010


On Tue, Jan 12, 2010 at 12:05, Sebastian Walter
<sebastian.walter at gmail.com> wrote:
> Hello,
> I have a question about the augmented assignment statements *=, +=, etc.
> Apparently, the casting of types is not working correctly. Is this
> known resp. intended behavior of numpy?

Augmented assignment modifies numpy arrays in-place, so the usual
casting rules for assignment into an array apply. Namely, the array
being assigned into keeps its dtype.

If you do not want in-place modification, do not use augmented assignment.

-- 
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless
enigma that is made terrible by our own mad attempt to interpret it as
though it had an underlying truth."
  -- Umberto Eco



More information about the NumPy-Discussion mailing list