Path: csiph.com!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.001 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'broken': 0.03; 'assign': 0.07; 'list?': 0.07; 'nested': 0.07; 'other,': 0.09; 'thread': 0.11; 'from:addr:tyler': 0.16; 'from:addr:tysdomain.com': 0.16; 'from:name:littlefield, tyler': 0.16; 'fully,': 0.16; 'message- id:@tysdomain.com': 0.16; 'received:69.164': 0.16; 'received:69.164.206': 0.16; 'received:69.164.206.65': 0.16; 'received:tds-solutions.net': 0.16; 'subject:Problem': 0.16; 'wrote:': 0.17; 'code.': 0.20; 'changes': 0.20; 'received:192.168.1.100': 0.22; 'work.': 0.23; "i've": 0.23; 'header:In-Reply-To:1': 0.25; 'header:User-Agent:1': 0.26; 'project:': 0.29; 'no,': 0.29; 'url:code': 0.29; 'subject:List': 0.33; 'to:addr:python-list': 0.33; 'code:': 0.33; 'pm,': 0.35; 'list.': 0.35; 'but': 0.36; 'why': 0.37; 'subject:: ': 0.38; 'to:addr:python.org': 0.39; 'received:192': 0.39; 'list,': 0.39; 'received:192.168': 0.40; 'link': 0.60; 'url:p': 0.63; 'light- weight': 0.84; 'care,': 0.91 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on wuff X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED autolearn=unavailable version=3.3.1 Date: Sun, 23 Sep 2012 18:56:47 -0600 From: "Littlefield, Tyler" User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:15.0) Gecko/20120907 Thunderbird/15.0.1 MIME-Version: 1.0 To: python-list@python.org Subject: Re: List Problem References: <5126348a-8e87-493d-975c-d6273e59784c@googlegroups.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 20 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1348448230 news.xs4all.nl 6851 [2001:888:2000:d::a6]:39274 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:29877 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.