Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!news.albasani.net!feeder.news-service.com!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.005 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'subject:Python': 0.04; 'identical': 0.07; '>>>': 0.12; 'am,': 0.14; 'wrote:': 0.14; '"=="': 0.16; '"is"': 0.16; '(1,': 0.16; 'immutable': 0.16; 'tuples,': 0.16; "wouldn't": 0.18; 'cc:no real name:2**0': 0.20; 'cc:2**0': 0.20; 'header:In-Reply-To:1': 0.22; 'cc:addr:python- list': 0.22; 'thu,': 0.22; 'gregory': 0.23; 'objects': 0.24; 'thus': 0.24; 'received:209.85.161.46': 0.26; 'received:mail- fx0-f46.google.com': 0.26; 'subject:data': 0.26; 'message- id:@mail.gmail.com': 0.28; 'definition': 0.29; 'received:209.85.161': 0.29; 'subject:?': 0.29; 'originally': 0.29; 'cc:addr:python.org': 0.31; 'compromise': 0.31; 'ewing': 0.31; 'objects.': 0.31; 'tuples': 0.31; 'using': 0.34; 'returned': 0.35; 'subject:What': 0.35; 'subject:use': 0.35; 'received:209.85': 0.37; 'proposed': 0.38; 'references': 0.38; 'received:google.com': 0.38; 'reasonable': 0.38; 'used': 0.38; 'though': 0.38; 'received:209': 0.39; 'would': 0.40; 'header:Received:5': 0.40; '2011': 0.62; 'subject:other': 0.84 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc:content-type:content-transfer-encoding; bh=/Y3U3Rgdjy5uvoOcYQtbT8II+aJNbraNPtvlX//voC0=; b=kLvHsM4CAZn+gY10BzaEmc9HXNmBVqpUI/rq1zHen3ww/D4D3SpaQMk1HAX7/+jyje H9/b3H8WQ3k2Hdl06M1WW5Coi962i4gViuVmskzwmrludOcIClq1ior0mjs8l9Rc3ICL vJp79UTSFi1xuzlop7cm9SdOTZMqM55IbAsmk= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type:content-transfer-encoding; b=ZmUdhKN4jS0NGuznT5gu7HD6d/ledNNBc3351As2U83d6g73W6RsmhL+ktBgl3kIrD DAxUqk3D8+nRBMwQOjRku1fmiLReYOVitq/s9p1NajjHX5EiVIEee+++Cr2McqoVJaeS lYI4wOAoHH/ynaciBVioTPcj62yoEYAkQgpQs= MIME-Version: 1.0 In-Reply-To: <4dc2c52e$0$10567$742ec2ed@news.sonic.net> References: <4dbd1dbf$0$29991$c3e8da3$5496439d@news.astraweb.com> <77f64071-b288-404c-8280-b2c61ba77f06@n10g2000yqf.googlegroups.com> <4dc12fb4$0$29991$c3e8da3$5496439d@news.astraweb.com> <4dc1ca92$0$10552$742ec2ed@news.sonic.net> <5smwp.309$BG2.230@newsfe08.iad> <4dc22882$0$10557$742ec2ed@news.sonic.net> <92fb5jFa2lU1@mid.individual.net> <4dc2c52e$0$10567$742ec2ed@news.sonic.net> From: Ian Kelly Date: Thu, 5 May 2011 10:44:39 -0600 Subject: Re: What other languages use the same data model as Python? To: John Nagle Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: python-list@python.org X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 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: 38 NNTP-Posting-Host: 82.94.164.166 X-Trace: 1304613911 news.xs4all.nl 41117 [::ffff:82.94.164.166]:35703 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:4758 On Thu, May 5, 2011 at 9:41 AM, John Nagle wrote: > On 5/5/2011 3:06 AM, Gregory Ewing wrote: >> >> John Nagle wrote: >> >>> A reasonable compromise would be that "is" is treated as "=3D=3D" on >>> immutable objects. >> >> That wouldn't work for tuples, which can contain references >> to other objects that are not immutable. > > =A0 =A0Such tuples are still identical, even if they > contain identical references to immutable objects. >>> a =3D (1, 2, [3, 4, 5]) >>> b =3D (1, 2, [3, 4, 5]) >>> a =3D=3D b True >>> a is b # Using the proposed definition True >>> a[0] is b[0] True >>> a[1] is b[1] True >>> a[2] is b[2] False >>> a[2].append(6) >>> a (1, 2, [3, 4, 5, 6]) >>> b (1, 2, [3, 4, 5]) >>> a =3D=3D b False >>> a is b False Thus a and b cannot be used interchangeably even though "a is b" originally returned True.