Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!1.eu.feeder.erje.net!bcyclone02.am1.xlned.com!bcyclone02.am1.xlned.com!newsfeed.xs4all.nl!newsfeed2.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.022 X-Spam-Evidence: '*H*': 0.96; '*S*': 0.00; 'true,': 0.04; 'testing,': 0.05; 'numpy': 0.16; 'wrote:': 0.16; '>>>': 0.20; 'to:name:python- list@python.org': 0.20; 'am,': 0.23; '2015': 0.23; 'header:In- Reply-To:1': 0.24; 'somewhere': 0.24; 'paul': 0.24; 'testing': 0.25; 'message-id:@mail.gmail.com': 0.28; 'equality': 0.29; 'subject:what': 0.29; 'fri,': 0.31; 'subject:?': 0.34; 'received:google.com': 0.34; 'to:addr:python-list': 0.35; 'false': 0.35; 'identity': 0.35; 'list': 0.35; 'subject:: ': 0.37; 'to:addr:python.org': 0.39; 'saw': 0.76; 'subject:here': 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=odTJQD7H9y4rpdS3bsZ7WP51vNKuxvGKeL+XQJZSP8A=; b=Clgc8UOmAOGPVOw0Ua7ocd9RZAQ2UG9n887ZRWa1MVpt6XlCTCPc2p02nDB3kDIF4Y OS+O6Bx54wBiUQVwnrYlbwcxoYIqP7mc5oQzaEyC+is87hzVJwQnNvl5AfTbEywpLnd2 EGvKduxdZeWLegd75JyMwvCpVdU+IRBNPcfoMhYYxinjO3SniD+2XqQCiZ1PceS8IcDc Z+AQi7s5ms5ae9I1CulPGecuFathjw0bQOLPKfKYctkxey+SmXo+vdFDn3Tlytef2dSA PCEA2/0jwHH2Yz7JvbN7NrnrgNq3OGpI6RK4DJcjfxE7Jyh8jqkIHF33MBG1U9hjJGLF vsKw== MIME-Version: 1.0 X-Received: by 10.194.235.100 with SMTP id ul4mr6134569wjc.33.1433508909540; Fri, 05 Jun 2015 05:55:09 -0700 (PDT) In-Reply-To: References: Date: Fri, 5 Jun 2015 08:55:09 -0400 Subject: Re: So what's happening here? From: Larry Martell To: "python-list@python.org" Content-Type: text/plain; charset=UTF-8 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.20+ 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: 22 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1433508911 news.xs4all.nl 2835 [2001:888:2000:d::a6]:57625 X-Complaints-To: abuse@xs4all.nl X-Received-Bytes: 3315 X-Received-Body-CRC: 29179091 Xref: csiph.com comp.lang.python:92139 On Fri, Jun 5, 2015 at 8:46 AM, Paul Appleby wrote: > I saw somewhere on the net that you can copy a list with slicing. So > what's happening when I try it with a numpy array? > >>>> a = numpy.array([1,2,3]) >>>> b = a[:] >>>> a is b > False >>>> b[1] = 9 >>>> a > array([1, 9, 3]) is is identity testing, == is equality testing >>> a = numpy.array([1,2,3]) >>> b = a[:] >>> a == b array([ True, True, True], dtype=bool) >>> id(a) 4510409872 >>> id(b) 4510410192