FW: Unexpexted behaviot of python operators on list
Denis McMahon
denismfmcmahon at gmail.com
Tue Nov 25 08:07:57 EST 2014
On Tue, 25 Nov 2014 12:20:26 +0000, Mark Lawrence wrote:
> a=[1,2,3]
binds a to the list [1,2,3]
> b=a
binds b to a
> b+=[4,5]
Changes existing b, which is also a
> x=[1,2,3]
binds x to the list [1,2,3]
> y=x
binds y to x
> y=y+[4,5]
Binds y to a new list which comprises previous y plus [4,5]
--
Denis McMahon, denismfmcmahon at gmail.com
More information about the Python-list
mailing list