When you did:
b = a[:]

b was then a copy of a, rather than just a reference to the same a.
But what does a contain?  It contains two sublists -- that is, it
contains references to two sublists.  So b, which is now a copy of a,
contains copies of the two references to the same two sublists.

What you need to do instead is:
b = copy.deepcopy(a)

to get you what you actually want.

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

Reply via email to