[Cython] Cython array type: Summary, introducing CEP 518

Robert Kern robert.kern at gmail.com
Thu Jun 18 21:52:02 CEST 2009


On 2009-06-18 14:15, Roland Schulz wrote:
>
>
> On Thu, Jun 18, 2009 at 3:11 PM, Dag Sverre Seljebotn
> <dagss at student.matnat.uio.no
> <mailto:dagss at student.matnat.uio.no>> wrote:
>
>     Dag Sverre Seljebotn wrote:
>      > Stefan Behnel wrote:
>      >> Dag Sverre Seljebotn wrote:
>
>
>     I stand corrected:
>
>     In [13]: a = [1,2,3]
>
>     In [14]: b = a
>
>     In [15]: a += [1,2,3]
>
>     In [16]: b
>     Out[16]: [1, 2, 3, 1, 2, 3]
>
>     OK, so this seems like a non-issue.
>
>
> interestingly :
>
>  >>> a=(1,2,3)
>  >>> b=a
>  >>> b+=(4,)
>  >>> a
> (1, 2, 3)

It's not that interesting. The augmented assignment operators "x ?= y" are 
defined to behave like "x = x ? y" except for *possible* in-place semantics. 
When the object is mutable, the operation is usually in-place. When the object 
is not mutable, then it is never in-place.

-- 
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 Cython-dev mailing list