Hi all,
Here's my issue:
>>> a = [1,2,3] #all good so far
>>> b = a #make a copy of a, called b
>>> b.remove(1) #remove value 1 from b ONLY
>>> print a #grrr, value has also been removed from a
[2, 3]
>>> print b #and b!
[2, 3]
Here's how I got around it:
>>> a = [1,2,3]
>>> b = []
>>> b.extend(a)
>>> b.remove(1)
>>> print a
[1, 2, 3]
>>> print b
[2, 3]
I was just wondering if anybody knew the reason behind this behavior, and if there is a more elegant way to accomplish the same thing. What does = really mean in Python?