[Cython] Cython array type: Summary, introducing CEP 518
Greg Ewing
greg.ewing at canterbury.ac.nz
Fri Jun 19 03:27:03 CEST 2009
Dag Sverre Seljebotn wrote:
> The problem is that if you do
>
> y = x
> x *= 2
>
> then in current NumPy, y and x will still point to the same memory and
> reference the same values (in fact, be the exact same view object).
>
> Usual Python semantics seems to imply that what NumPy *should* have done
> is let the latter line mean "x = x * 2"
I don't follow that. Usual Python semantics for in-place
operations on mutable types also leaves x and y referring
to the same object. Given the way Numpy defines the *
operator, it's doing exactly what I would expect here.
--
Greg
More information about the Cython-dev
mailing list