Path: csiph.com!usenet.pasdenom.info!gegeweb.org!usenet-fr.net!nerim.net!novso.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.009 X-Spam-Evidence: '*H*': 0.98; '*S*': 0.00; 'true,': 0.04; 'expressions': 0.07; 'python': 0.09; 'expression:': 0.09; 'cc:addr :python-list': 0.10; 'language': 0.14; 'benjamin': 0.16; 'executed.': 0.16; 'expressions,': 0.16; 'int.': 0.16; 'integers,': 0.16; 'integers.': 0.16; 'said.': 0.16; 'true:': 0.16; 'valid.': 0.16; 'wrote:': 0.17; 'pointed': 0.17; 'specify': 0.17; 'string,': 0.17; 'thanks,': 0.18; 'all,': 0.21; 'object.': 0.22; 'cc:2**0': 0.23; 'statement': 0.23; 'cc:no real name:2**0': 0.24; 'cc:addr:python.org': 0.25; 'header:In-Reply-To:1': 0.25; 'header:User-Agent:1': 0.26; 'am,': 0.27; 'no,': 0.29; 'subject: ?': 0.30; 'not.': 0.32; 'could': 0.32; 'thanks': 0.34; 'but': 0.36; 'compare': 0.36; 'anything': 0.36; 'subject:with': 0.36; 'should': 0.36; 'address.': 0.36; 'does': 0.37; 'two': 0.37; 'subject:: ': 0.38; 'mean': 0.38; 'object': 0.38; 'some': 0.38; 'nothing': 0.38; 'sure': 0.38; 'delete': 0.38; 'received:192': 0.39; 'received:192.168': 0.40; 'think': 0.40; 'your': 0.60; 'matter': 0.61; 'share': 0.61; 'evaluate': 0.62; 'header:Reply- To:1': 0.68; 'physical': 0.69; 'received:74.208': 0.71; 'reply- to:no real name:2**0': 0.72; 'received:74.208.4.194': 0.84; 'risking': 0.84; 'hand,': 0.97 Date: Wed, 05 Sep 2012 10:00:09 -0400 From: Dave Angel User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:14.0) Gecko/20120714 Thunderbird/14.0 MIME-Version: 1.0 To: Franck Ditter Subject: Re: is implemented with id ? References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Provags-ID: V02:K0:aILnumty78pjsFPxFG5Frkx96adTdd3knC8B7G+pR9m BEPbwAHV4G5pHcSIGKrtoSX8uqZuAmpYuosGFhI2xKo9I/4SsZ lhthaalk0lCHQnddt9sLy4Z0IdlZXJPlmKNzbNBWfMj9JwPkW1 ZqIYUIrkojl5Jja3dqeFwG0O6N2XCi1EJJgm0J3wKVfJ7edqxA JrK2GMwsPuiv7GKZnKdZ8gfS1dnTKey2AT/j86Y7xOYhsM8sty 1Ae6yzxLSJoO/Y+Ea/WRuUza3h8a/tzqLAZNStfgaqiMpy2aMo NYMMGC6T2c05PNodIGtfJ/L9pgvJtrtVHvYQeTD3RF7ErRFug= = Cc: python-list@python.org X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list Reply-To: d@davea.name 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: 36 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1346853638 news.xs4all.nl 6972 [2001:888:2000:d::a6]:40697 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:28497 Please don't top-post. Now your message is out of order, and if I have to delete the part Benjamin said. On 09/05/2012 09:19 AM, Franck Ditter wrote: > Thanks to all, but : > - I should have said that I work with Python 3. Does that matter ? > - May I reformulate the queston : "a is b" and "id(a) == id(b)" > both mean : "a et b share the same physical address". Is that True ? > Thanks, No, id() has nothing to do with physical address. The Python language does not specify anything about physical addresses. Some implementations may happen to use physical addresses, others arbitrary integers. And they may reuse such integers, or not. Up to the implementation. And as others have pointed out, when you compare two id's, you're risking that one of them may no longer be valid. For example, the following expression: flag = id(func1()) == id(func2()) could very well evaluate to True, even if func1() always returns a string, and func2() always returns an int. On the other hand, the 'is' expression makes sure the two expressions are bound to the same object. If a and b are simple names, and not placeholders for arbitrary expressions, then I THINK the following would be true: "a is b" and "id(a) == id(b)" both mean that the names a and b are bound to the same object at the time the statement is executed. -- DaveA