Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.net!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!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.004 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'assign': 0.07; 'list?': 0.07; 'sep': 0.09; 'thread': 0.11; '24,': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'fully,': 0.16; 'subject:Problem': 0.16; 'mon,': 0.16; 'wrote:': 0.17; 'elements': 0.23; "i've": 0.23; 'header:In-Reply-To:1': 0.25; 'am,': 0.27; 'message-id:@mail.gmail.com': 0.27; 'lists': 0.31; 'subject:List': 0.33; 'problem': 0.33; 'to:addr:python- list': 0.33; 'received:google.com': 0.34; 'received:209.85': 0.35; 'but': 0.36; 'why': 0.37; 'received:209': 0.37; 'subject:: ': 0.38; 'to:addr:python.org': 0.39; 'list,': 0.39; 'header:Received:5': 0.40 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=GU6xO/f0CpZdwaCHADXj8JP03f3ekVXTjSMi3KlJ1fo=; b=jQQYNiT/QVyJb/iRxJgz24FKBxW+fr5U4SZwIjcCx4SHDHFGCxlRv1NioKY5dtor1h F4OUnGsHzAhSQe+7WaIqHtdZzvS6hC0KeOgjJcqkCQUqsUuvl+U73swEDthJbBFGJP67 uYBHr3oqmvF5nXBhbe1CtjlF5Kj4FmlPbHjnsXprcnx51i1e6RcNG4q1ab974xf6mKXv rAEsvMrwBfbljtIQU5b0beGWA+eIdZgtGEgAH/kxSUCe5ozTUMjfOQ7PYGv9LqJWDmks 24EhJfUYGLhLdoKXl2ks0UPloNp3WkkDORRSfmRRgw60uMVmP2jefjLOjD06Knx2MOp3 QQuA== MIME-Version: 1.0 In-Reply-To: <505FAFCF.6030502@tysdomain.com> References: <5126348a-8e87-493d-975c-d6273e59784c@googlegroups.com> <505FAFCF.6030502@tysdomain.com> Date: Mon, 24 Sep 2012 11:52:22 +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: 10 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1348451545 news.xs4all.nl 6848 [2001:888:2000:d::a6]:33914 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:29882 On Mon, Sep 24, 2012 at 10:56 AM, Littlefield, Tyler wrote: > 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. The problem is with lists as elements of that list, so the key is deepcopy. ChrisA