Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed4.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.005 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'wrong,': 0.09; 'jan': 0.12; '4:25': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'reedy': 0.16; 'wrote:': 0.18; 'example': 0.22; 'header:User- Agent:1': 0.23; 'compare': 0.26; 'header:X-Complaints-To:1': 0.27; 'header:In-Reply-To:1': 0.27; 'correct': 0.29; 'generally': 0.29; 'object.': 0.31; 'but': 0.35; 'false': 0.36; 'to:addr:python- list': 0.38; 'pm,': 0.38; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'according': 0.40; 'received:fios.verizon.net': 0.84 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Terry Reedy Subject: Re: id() and is operator Date: Mon, 23 Feb 2015 01:02:13 -0500 References: <87f18c68-120d-44f2-bd34-6f73c69365da@googlegroups.com> <871tlhiqpz.fsf@elektro.pacujo.net> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Gmane-NNTP-Posting-Host: pool-98-114-97-173.phlapa.fios.verizon.net User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.4.0 In-Reply-To: <871tlhiqpz.fsf@elektro.pacujo.net> 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: 30 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1424671345 news.xs4all.nl 2886 [2001:888:2000:d::a6]:42591 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:86192 On 2/22/2015 4:25 PM, Marko Rauhamaa wrote: > LJ : > >>>>> id(b[0]) >> 45855552 > [...] >>>>> id(b[2]) >> 45855552 >> Please correct me if I am wrong, but according to this b[2] and b[0] >> are the same object. Now, >> >>>>> b[0] is b[2] >> False > > This is a true statement: > > If X is Y, then id(X) == id(Y). > > However, this is generally not a true statement: > > If X is Y, then id(X) is id(Y). If X and Y exist at the *same time*, then (X is Y) == (id(X) is id(Y)). Since X and Y in the example above do not exist at the same time, it is nonsensical to compare them. -- Terry Jan Reedy