Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.net!eu.feeder.erje.net!xlned.com!feeder3.xlned.com!newsfeed.xs4all.nl!newsfeed4a.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.018 X-Spam-Evidence: '*H*': 0.96; '*S*': 0.00; 'operator': 0.03; 'cc:addr :python-list': 0.11; 'assume': 0.14; '"is"': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'less,': 0.16; 'operands': 0.16; 'sat,': 0.16; 'wrote:': 0.18; 'feb': 0.22; '>>>': 0.22; 'example': 0.22; '(in': 0.22; 'cc:addr:python.org': 0.22; 'tells': 0.24; 'cc:2**0': 0.24; '15,': 0.26; 'values': 0.27; 'header:In-Reply-To:1': 0.27; 'am,': 0.29; 'subject:list': 0.30; 'message-id:@mail.gmail.com': 0.30; 'ones.': 0.31; 'received:google.com': 0.35; 'false': 0.36; 'object,': 0.36; 'possible': 0.36; 'two': 0.37; 'either': 0.39; 'skip:u 10': 0.60; 'more': 0.64; 'situation': 0.65; 'ambiguous': 0.84; 'case?': 0.84; 'to:none': 0.92 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:cc :content-type; bh=zXMMZtemkWpkqzTVOYIYFsHuJEJeYRHap9h3sg8QnqE=; b=gJb4gikM4ITz6cKr58JxElXOFIFOdDMN9//HoprvGQLwYWy55+xufeV9NMDHY/tswi kjBKIUuuBXCZrEJxoEkimuwJwX7E8Fr/lRXrQrJx9zKePtMftUQlbufbyz/YBEuzStx8 BABROEYRY5GsvLyrjpyab/rgWGw7QSzDTebo5arIOjrJbCTVbSerfaNMVYtLlGbsu43e wJPLJFFpxP9zDLFjM0sY5zThgbWO5ETlbYDwARIwlfPI+SW1RbQVdlmxZyl9iGyQIpg+ tJZPZspDGUK61Rou3fIIxZlDCdW1j/zdaWxjRKNAwbbIEXW6bphjvDQ6C93wichgtb8x Neqg== MIME-Version: 1.0 X-Received: by 10.68.143.231 with SMTP id sh7mr12584640pbb.7.1392425853697; Fri, 14 Feb 2014 16:57:33 -0800 (PST) In-Reply-To: <87mwhtnzdu.fsf@elektro.pacujo.net> References: <13208de8-0f85-4e60-b059-dc087c8fda41@googlegroups.com> <917ede6d-db7c-4a8c-8203-27677283776b@googlegroups.com> <871tz5piy0.fsf@elektro.pacujo.net> <87vbwho1i0.fsf@elektro.pacujo.net> <87mwhtnzdu.fsf@elektro.pacujo.net> Date: Sat, 15 Feb 2014 11:57:33 +1100 Subject: Re: Explanation of list reference From: Chris Angelico Cc: "python-list@python.org" Content-Type: text/plain; charset=UTF-8 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: 22 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1392425862 news.xs4all.nl 2871 [2001:888:2000:d::a6]:55578 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:66343 On Sat, Feb 15, 2014 at 8:43 AM, Marko Rauhamaa wrote: > Unfortunately neither the "everything is a reference" model nor the > "small/big" model help you predict the value of an "is" operator in the > ambiguous cases. Can you give an example of an ambiguous case? Fundamentally, the 'is' operator tells you whether its two operands are exactly the same object, nothing more and nothing less, so I assume your "ambiguous cases" are ones where it's possible for two things to be either the same object or two indistinguishable ones. The only situation I can think of is that immutables are allowed to be interned, which is why this comes up True (in CPython) when it would come up False with larger values (as I demonstrated earlier): >>> x = 1 >>> y = 2 >>> z = x + y >>> z is 3 True ChrisA