[Python-ideas] clear() method for lists

Mathias Panzenböck grosser.meister.morti at gmx.net
Thu Feb 11 16:34:28 CET 2010


On 02/11/2010 04:21 PM, Matthew Russell wrote:
> this seems to work in python 2.x and python3.1, although I suspect it's
> a bug.
>
>  >>> t = (1, 2)
>  >>> t += (3,)
>  >>> t
> (1, 2, 3)
>

I don't see any bug. "x += y" is equal to "x = x + y".

 >>> t=(1,2)
 >>> t2=t
 >>> t+=(3,)
 >>> t,t2
((1, 2, 3), (1, 2))



More information about the Python-ideas mailing list