Path: csiph.com!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder1.enfer-du-nord.net!feeds.phibee-telecom.net!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.000 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'broken': 0.03; 'assign': 0.07; 'indices': 0.07; 'nested': 0.07; 'suppress': 0.07; 'python': 0.09; 'counting': 0.09; 'other,': 0.09; 'sep': 0.09; 'index': 0.13; 'weird': 0.15; '24,': 0.16; 'end).': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'subject:Problem': 0.16; 'mon,': 0.16; 'wrote:': 0.17; 'issue,': 0.17; 'code.': 0.20; 'changes': 0.20; 'received:209.85.214.174': 0.21; "i'd": 0.22; 'work.': 0.23; 'originally': 0.23; 'script': 0.24; 'header:In-Reply-To:1': 0.25; 'am,': 0.27; 'message- id:@mail.gmail.com': 0.27; 'there.': 0.28; 'run': 0.28; '(since': 0.29; 'no,': 0.29; "i'm": 0.29; 'code': 0.31; 'subject:List': 0.33; 'to:addr:python-list': 0.33; 'code:': 0.33; 'another': 0.33; "can't": 0.34; 'received:google.com': 0.34; 'list': 0.35; 'received:209.85': 0.35; 'list.': 0.35; 'but': 0.36; 'received:209': 0.37; 'far': 0.37; 'subject:: ': 0.38; 'nothing': 0.38; 'to:addr:python.org': 0.39; 'received:209.85.214': 0.39; 'list,': 0.39; 'header:Received:5': 0.40; 'think': 0.40; 'your': 0.60; 'link': 0.60; 'first': 0.61; 'certain,': 0.84; 'treats': 0.84 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=A85Y3q+s4bjgc3K57SomUOmRRlmwOlhVKHuYfQr7224=; b=r3HcCInn41a2QLmgbm9we/dOOqGSWM0i1StClCZ6A1chPkGgzKS4t20kxrw4vcUcMu 1shdHDJD2RtXU+LohrkqR6DmRkIAw7DHWonBKPED7h7WaM27N3Y4S9gN5F2mNiceDm5I bZv8aoveuk2RxUUmNEVeE2l7wgW+YsXp/72w7nCmLsnJaqUZxe2JFYRhOk2XChJiyd0z OSTdypJb/0igWE3NnTKYCu7YGscc33zIrkQSZqyQSpLuKEU+y6zVGn1KWa3tQXuuZ/nl AMg6nco1QZdMV8VS4rw25xuTBL9HfhilS4BZpyC/v6CdfXdKHFmcG+ROzU/AFytzDSrc 39Jw== MIME-Version: 1.0 In-Reply-To: References: <5126348a-8e87-493d-975c-d6273e59784c@googlegroups.com> Date: Mon, 24 Sep 2012 07:57:26 +1000 Subject: Re: List Problem From: Chris Angelico To: python-list@python.org Content-Type: text/plain; charset=ISO-8859-1 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: 19 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1348437456 news.xs4all.nl 6879 [2001:888:2000:d::a6]:50037 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:29861 On Mon, Sep 24, 2012 at 7:44 AM, 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. The first thing I'd change about that code is the whole thing of using try/exec/except to suppress IndexError. Definitely not good code. I'm not wholly certain, but I think you might run into weird issues with negative OOBounds indices (since Python treats a negative list index as counting from the far end). This is nothing to do with your originally requested issue, which I can't see the cause of in your script there. But when you assign a list, you just get another reference to the same list. ChrisA