Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #28494

Re: is implemented with id ?

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 <d@davea.name>
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 <d@davea.name>
User-Agent Mozilla/5.0 (X11; Linux x86_64; rv:14.0) Gecko/20120714 Thunderbird/14.0
MIME-Version 1.0
To Ramchandra Apte <maniandram01@gmail.com>
Subject Re: is implemented with id ?
References <franck-9EED34.08303005092012@news.free.fr> <504717ee$0$29977$c3e8da3$5496439d@news.astraweb.com> <b8c2c4dc-2afa-4921-bac1-1614e57c3e97@googlegroups.com>
In-Reply-To <b8c2c4dc-2afa-4921-bac1-1614e57c3e97@googlegroups.com>
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 <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.237.1346852814.27098.python-list@python.org> (permalink)
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

Show key headers only | View raw


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:
>> <snip> 
>>
> 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

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

is implemented with id ? Franck Ditter <franck@ditter.org> - 2012-09-05 08:30 +0200
  Re: is implemented with id ? Benjamin Kaplan <benjamin.kaplan@case.edu> - 2012-09-04 23:40 -0700
    Re: is implemented with id ? Franck Ditter <franck@ditter.org> - 2012-09-05 15:19 +0200
      Re: is implemented with id ? Hans Mulder <hansmu@xs4all.nl> - 2012-09-05 15:48 +0200
        Re: is implemented with id ? aahz@pythoncraft.com (Aahz) - 2012-11-03 12:41 -0700
          Re: is implemented with id ? Hans Mulder <hansmu@xs4all.nl> - 2012-11-03 22:49 +0100
            Re: is implemented with id ? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-11-03 22:18 +0000
              Re: is implemented with id ? Chris Angelico <rosuav@gmail.com> - 2012-11-04 09:50 +1100
              Re: is implemented with id ? Oscar Benjamin <oscar.j.benjamin@gmail.com> - 2012-11-04 01:14 +0000
                Re: is implemented with id ? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-11-04 03:10 +0000
                Re: is implemented with id ? Chris Angelico <rosuav@gmail.com> - 2012-11-04 14:19 +1100
                Re: is implemented with id ? aahz@pythoncraft.com (Aahz) - 2012-11-03 22:09 -0700
                Re: is implemented with id ? Hans Mulder <hansmu@xs4all.nl> - 2012-11-04 11:13 +0100
              Re: is implemented with id ? Chris Angelico <rosuav@gmail.com> - 2012-11-04 12:22 +1100
              Re: is implemented with id ? aahz@pythoncraft.com (Aahz) - 2012-11-03 22:08 -0700
            Re: is implemented with id ? Roy Smith <roy@panix.com> - 2012-11-03 18:41 -0400
            Re: is implemented with id ? aahz@pythoncraft.com (Aahz) - 2012-11-03 22:12 -0700
      Re: is implemented with id ? Dave Angel <d@davea.name> - 2012-09-05 10:00 -0400
        Re: is implemented with id ? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-09-05 14:41 +0000
          Re: is implemented with id ? Dave Angel <d@davea.name> - 2012-09-05 11:09 -0400
            Re: is implemented with id ? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-09-05 15:36 +0000
            Re: is implemented with id ? Hans Mulder <hansmu@xs4all.nl> - 2012-09-05 18:47 +0200
              Re: is implemented with id ? Dave Angel <d@davea.name> - 2012-09-05 13:19 -0400
          Re: is implemented with id ? Terry Reedy <tjreedy@udel.edu> - 2012-09-05 14:31 -0400
          Re: is implemented with id ? Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2012-09-05 22:08 -0400
          Re: is implemented with id ? Duncan Booth <duncan.booth@invalid.invalid> - 2012-09-06 09:34 +0000
            Re: is implemented with id ? Chris Angelico <rosuav@gmail.com> - 2012-09-06 19:50 +1000
          Re: is implemented with id ? 88888 Dihedral <dihedral88888@googlemail.com> - 2012-11-04 01:33 -0700
  Re: is implemented with id ? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-09-05 09:14 +0000
    Re: is implemented with id ? Ramchandra Apte <maniandram01@gmail.com> - 2012-09-05 05:48 -0700
      Re: is implemented with id ? Dave Angel <d@davea.name> - 2012-09-05 09:46 -0400
      Re: is implemented with id ? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-09-05 14:13 +0000
        Re: is implemented with id ? Ian Kelly <ian.g.kelly@gmail.com> - 2012-09-05 11:08 -0600
        Re: is implemented with id ? Chris Angelico <rosuav@gmail.com> - 2012-09-06 19:07 +1000
      Re: is implemented with id ? Terry Reedy <tjreedy@udel.edu> - 2012-09-05 14:27 -0400
        Re: is implemented with id ? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-09-06 06:44 +0000
          Re: is implemented with id ? Ramchandra Apte <maniandram01@gmail.com> - 2012-09-06 01:24 -0700
          Re: is implemented with id ? Roy Smith <roy@panix.com> - 2012-09-06 08:16 -0400
            Re: is implemented with id ? Ramchandra Apte <maniandram01@gmail.com> - 2012-09-06 06:30 -0700
      Re: is implemented with id ? Dave Angel <d@davea.name> - 2012-09-05 14:40 -0400

csiph-web