[SciPy-user] fancy indexing and +=

Robert Kern robert.kern at gmail.com
Fri Sep 1 22:09:18 CDT 2006


A. M. Archibald wrote:
> On 01/09/06, Robert Kern <robert.kern at gmail.com> wrote:
> 
>> Nor should we. According to the reference manual, augmented assignment methods
>> should be implemented such that
>>
>>    x += y
>>
>> is nearly equivalent to
>>
>>    x = x + y
>>
>> with the exception of possible in-place modification of x.
> 
> One could argue that what I was asking for is the appropriate notion
> of "in-place modification" in this context, but that's a technicality.

Well, not quite. The idea that the manual is trying to express is that both 
forms, "x += y" and "x = x + y" should result in final values of "x" that are 
the equal to each other. The only difference should be that the *identities* of 
the objects finally referenced by "x" might be different.

-- 
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 SciPy-user mailing list