Path: csiph.com!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed5.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.001 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'syntax': 0.03; 'expressions': 0.07; 'function,': 0.07; 'mess': 0.09; 'stale': 0.09; 'thread,': 0.09; 'cc:addr:python-list': 0.10; 'yet.': 0.13; '(eg.': 0.16; 'comparison.': 0.16; 'debugging,': 0.16; 'discarded.': 0.16; 'enough.': 0.16; 'wrote:': 0.17; 'comparing': 0.17; 'removed.': 0.17; 'memory': 0.18; 'wednesday,': 0.22; 'cc:2**0': 0.23; "haven't": 0.23; 'cc:no real name:2**0': 0.24; 'second': 0.24; 'cc:addr:python.org': 0.25; 'header:In-Reply- To:1': 0.25; 'header:User-Agent:1': 0.26; 'am,': 0.27; 'object,': 0.27; "d'aprano": 0.29; 'steven': 0.29; 'subject: ?': 0.30; 'function': 0.30; 'gets': 0.32; 'changed': 0.34; 'there': 0.35; 'but': 0.36; "didn't": 0.36; 'useful': 0.36; 'subject:with': 0.36; 'should': 0.36; 'two': 0.37; 'subject:: ': 0.38; 'object': 0.38; 'received:192': 0.39; 'received:192.168': 0.40; 'think': 0.40; 'skip:u 10': 0.60; 'header:Reply-To:1': 0.68; 'carefully': 0.71; 'received:74.208': 0.71; 'reply-to:no real name:2**0': 0.72 Date: Wed, 05 Sep 2012 09:46:31 -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: Ramchandra Apte Subject: Re: is implemented with id ? References: <504717ee$0$29977$c3e8da3$5496439d@news.astraweb.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Provags-ID: V02:K0:PFmcX0gIHyMsYQuKFAZdaEg4qWjWOQWMt3JBG1MlKOS f5eLc5t7WfDHN8KpRn8pbM/GV/eeAXsmiGRIsXT5tsn0YqvaGQ ro/OBAqhZtpSR4pzc6ohbj9BAiqZ+q1bVra6YOjJCYkNVpuzRk sXnoF/lU8odFsUwSzTKIb7lE6KbARSmdru08Khud9jD7mGz8Vm rex2AGO4NDAbiI+nqXsy13/PbueVjppuxrnVeDVlYBHn3EIm4z y+Xs3xlNpkIYhCPXGehhjWOcNwfWUVP+MRPFckkBx3mDoEF+zN kAn94qr5BFARKeOU0xBpBp2MjYoNNhWcwqnJ7EiOEioRF/ZxQ= = 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: 23 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1346852814 news.xs4all.nl 6921 [2001:888:2000:d::a6]:59572 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:28494 On 09/05/2012 08:48 AM, Ramchandra Apte wrote: > On Wednesday, 5 September 2012 14:44:23 UTC+5:30, Steven D'Aprano wrote: >> >> > Seeing this thread, I think the is statment should be removed. > It has a replacement syntax of id(x) == id(y) and "a==True" should be automatically changed into memory comparison. You didn't read the whole message carefully enough. Id's can be reused, so there are many ways to mess up comparing id's. One is if the two items x and y are expressions (eg. function calls). You call a function, and say it returns a new object, you call id() on that object, and then the object gets discarded. You now have a stale id, and you haven't even evaluated the second expression yet. It's id() which is superfluous. But it's useful for debugging, and for understanding. -- DaveA