Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #92139

Re: So what's happening here?

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 <larry.martell@gmail.com>
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 <pan.2015.06.05.12.46.21@nowhere.invalid>
References <pan.2015.06.05.12.46.21@nowhere.invalid>
Date Fri, 5 Jun 2015 08:55:09 -0400
Subject Re: So what's happening here?
From Larry Martell <larry.martell@gmail.com>
To "python-list@python.org" <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 <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.195.1433508911.13271.python-list@python.org> (permalink)
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

Show key headers only | View raw


On Fri, Jun 5, 2015 at 8:46 AM, Paul Appleby <pap@nowhere.invalid> 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

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

So what's happening here? Paul Appleby <pap@nowhere.invalid> - 2015-06-05 12:46 +0000
  Re: So what's happening here? Fabien <fabien.maussion@gmail.com> - 2015-06-05 14:52 +0200
  Re: So what's happening here? Larry Martell <larry.martell@gmail.com> - 2015-06-05 08:55 -0400
  Re: So what's happening here? Peter Otten <__peter__@web.de> - 2015-06-05 15:09 +0200
  Re: So what's happening here? Paul Appleby <pap@nowhere.invalid> - 2015-06-05 13:11 +0000
    Re: So what's happening here? Gary Herron <gary.herron@islandtraining.com> - 2015-06-05 06:23 -0700
    Re: So what's happening here? Steven D'Aprano <steve@pearwood.info> - 2015-06-05 23:51 +1000
    Re: So what's happening here? Nobody <nobody@nowhere.invalid> - 2015-06-05 15:13 +0100

csiph-web