> On Behalf Of [EMAIL PROTECTED] > So - it looks that in list "b" there copy of all objects from list "a" > including not copy of list [5,6,7] but reference to it. > > Is there simple way to copy a into b (like a[:]) with all > copies of all objects going as deep as possible? Or it can be > done only manually?
I'd suggest checking out copy.deepcopy. >>> a = [1, [1, 2, 3], 2] >>> b = a[:] >>> a[1][2] = 'spam' >>> b [1, [1, 2, 'spam'], 2] >>> from copy import deepcopy >>> b = deepcopy(a) >>> a[1][2] = 'deepcopy is your friend' >>> b [1, [1, 2, 'spam'], 2] Regards, Ryan Ginstrom -- http://mail.python.org/mailman/listinfo/python-list