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


Groups > comp.lang.python > #28537

Re: is implemented with id ?

Path csiph.com!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder1.enfer-du-nord.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!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.000
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'exception': 0.03; 'syntax': 0.03; '"""': 0.05; 'cpython': 0.05; 'none,': 0.05; 'does,': 0.09; 'none.': 0.09; 'terry': 0.09; 'thread,': 0.09; 'cc:addr:python-list': 0.10; 'thread': 0.11; "wouldn't": 0.11; '"is"': 0.16; 'comparison.': 0.16; 'means.': 0.16; 'reedy': 0.16; "steve's": 0.16; 'substituted': 0.16; 'valid.': 0.16; 'wrote:': 0.17; 'removed.': 0.17; 'memory': 0.18; 'written': 0.20; 'cc:2**0': 0.23; 'cc:no real name:2**0': 0.24; 'idea': 0.24; 'testing': 0.24; 'cc:addr:python.org': 0.25; 'header:In-Reply- To:1': 0.25; 'header:User-Agent:1': 0.26; 'am,': 0.27; 'implemented': 0.27; 'then.': 0.27; 'comparison': 0.29; 'objects': 0.29; 'probably': 0.29; 'subject: ?': 0.30; 'changed': 0.34; 'wrong': 0.34; 'apply.': 0.35; 'exist': 0.35; 'pm,': 0.35; 'subject:with': 0.36; 'should': 0.36; 'two': 0.37; 'subject:: ': 0.38; 'comment': 0.38; 'object': 0.38; 'received:192': 0.39; 'received:192.168': 0.40; 'think': 0.40; 'identity.': 0.65; 'header:Reply-To:1': 0.68; 'received:74.208': 0.71; 'reply-to:no real name:2**0': 0.72; 'as:': 0.75; 'received:74.208.4.194': 0.84; 'eliminates': 0.93
Date Wed, 05 Sep 2012 14:40:06 -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 Terry Reedy <tjreedy@udel.edu>
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> <k285j8$dhj$1@ger.gmane.org>
In-Reply-To <k285j8$dhj$1@ger.gmane.org>
Content-Type text/plain; charset=ISO-8859-1
Content-Transfer-Encoding 7bit
X-Provags-ID V02:K0:r4OYFJv5nGOvsoexu2qQOfR9ev/V02dH8dCJHlAs1d9 st7TFGGgIpabSfsBClbWcLmpmBCpT9YZ48oH5KxD4BS3VUBHb+ l5/Oy6k04uue3+yflo/RimKLk4Djeba4wUzqgus9XEi1lHfaeZ u9tUh1PmvV/EeAW8EA346HbgWME23Ccqu0fYnhCMt0oXRM+o8w 0dAFT0YdMBjst3/KJ3eQ83kmqPRgm1abGM0EVfrHyOuXmO2sQ6 7TzIQlo6EfCrqIjM13i4mZTRBgTw5eVMUsPIUdKuYuOdwoc6dv jKJ3drxQ9nSmQs5lk6NRfExrm+fv1h7C+sK7/XM1j91OWOu7Q= =
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.264.1346870431.27098.python-list@python.org> (permalink)
Lines 41
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1346870431 news.xs4all.nl 6926 [2001:888:2000:d::a6]:44169
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:28537

Show key headers only | View raw


On 09/05/2012 02:27 PM, Terry Reedy wrote:
> On 9/5/2012 8:48 AM, Ramchandra Apte wrote:
>
>> Seeing this thread, I think the is statment should be removed.
>> It has a replacement syntax of id(x) == id(y)
>
> The thread is wrong then.
>
> If the implementation reuses ids, which CPython does,
> <expression-1> is <expression-2>
> must be implemented as
>
> internal-tem1 = <expression-1>
> internal-tem2 = <expression-2>
> id(internal-tem1) == id(internal-tem2)
>
> in order to ensure that the two objects exist simultaneously,
> so that the id comparison is valid.
>
> > and "a==True" should be automatically changed into memory comparison.
>
> I have no idea what that means.
>

It's probably a response to Steve's comment

"""

In general, you almost never need to care about IDs and object identity. 
The main exception is testing for None, which should always be written as:

    if x is None
"""

 Somehow he substituted True for None.  Anyway, if one eliminates "is"
then Steve's comment wouldn't apply.

-- 

DaveA

Back to comp.lang.python | Previous | NextPrevious 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