Dag Sverre Seljebotn wrote:
>> # Some ways of multiplying all elements with 2
>> x *= 2
>> x[...] *= 2
>> x[:,:] *= 2
>> x += x
>> x[...] += x
> 
> OK I'll make an exception here -- I'm willing to discuss whether we 
> should depart from NumPy semantics here and let
> 
> x2 = x
> x *= 2
> 
> allocate new memory, so that x2 is not modified, being consistent with a 
> direct transformation to "x = x * 2". One can always write
> 
> x[...] *= 2
> 
> if one wishes to modify original memory.

What's wrong with

        x = 2 * x2

for doing a copy ?

x *= 2

pretty clearly states that I want to modify x in place.

Stefan
_______________________________________________
Cython-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/cython-dev

Reply via email to