On 9/23/2012 3:44 PM, jimbo1qaz wrote:
On Sunday, September 23, 2012 2:31:48 PM UTC-7, jimbo1qaz wrote:
I have a nested list. Whenever I make a copy of the list, changes in one affect
the other, even when I use list(orig) or even copy the sublists one by one. I
have to manually copy each cell over for it to work.
Link to broken code: http://jimbopy.pastebay.net/1090401
No, actually that's the OK code. http://jimbopy.pastebay.net/1090494 is the
broken one.
I've not been following this thread fully, but why not just use
x=list(y) to copy the list?
The issue is that when you assign i=[1,2,3] and then j = i, j is just a
reference to i, which is why you change either and the other changes.
--
Take care,
Ty
http://tds-solutions.net
The aspen project: a barebones light-weight mud engine:
http://code.google.com/p/aspenmud
He that will not reason is a bigot; he that cannot reason is a fool; he that
dares not reason is a slave.
--
http://mail.python.org/mailman/listinfo/python-list