Gabriel Zachmann wrote:

> It seems to me that the following behavior of python (2.4.1) is
> inconsistent:
>
>  >>> a=1
>  >>> b=a
>  >>> a+=1
>  >>> b
> 1
>  >>> a
> 2
>  >>> a=[1,2]
>  >>> b=a
>  >>> b+=[3]
>  >>> a
> [1, 2, 3]
>  >>> b
> [1, 2, 3]
>
> Why was it implemented like this??

assuming that you know that integers cannot modified in place, and
that += on a list is defined to be the same thing as a call to extend,
what did you expect this to do?

</F>



-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to