Path: csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!newsfeed.xs4all.nl!newsfeed3a.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.003 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'python.': 0.02; 'operator': 0.03; 'exists.': 0.07; 'memory.': 0.07; 'created,': 0.09; 'objects,': 0.09; 'separately': 0.09; 'changes': 0.15; '"is"': 0.16; 'compares': 0.16; 'created;': 0.16; 'distinct': 0.16; 'idx': 0.16; 'literals': 0.16; 'mean,': 0.16; "object's": 0.16; 'objects.': 0.16; 'objects;': 0.16; 'sat,': 0.16; 'ignore': 0.16; 'wrote:': 0.18; 'value.': 0.19; 'feb': 0.22; '>>>': 0.22; 'all:': 0.24; 'integer': 0.24; 'logical': 0.24; 'test.': 0.24; '15,': 0.26; 'defined': 0.27; 'skip:" 20': 0.27; 'header:In-Reply- To:1': 0.27; 'function': 0.29; 'am,': 0.29; 'thus': 0.29; 'subject:list': 0.30; 'message-id:@mail.gmail.com': 0.30; '>>>>': 0.31; "d'aprano": 0.31; 'safely': 0.31; 'steven': 0.31; 'this.': 0.32; "can't": 0.35; 'knows': 0.35; 'objects': 0.35; 'point.': 0.35; 'test': 0.35; 'received:google.com': 0.35; '+0200,': 0.36; 'false': 0.36; 'representing': 0.36; 'two': 0.37; 'being': 0.38; 'to:addr:python-list': 0.38; 'to:addr:python.org': 0.39; 'users': 0.40; 'how': 0.40; 'even': 0.60; 'read': 0.60; 'most': 0.60; 'simple': 0.61; 'address': 0.63; 'show': 0.63; 'talking': 0.65; 'details': 0.65; 'formulated': 0.84; 'resistant': 0.84; 'am.': 0.91; 'notion': 0.91; 'why?': 0.91 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; bh=EpRDBprlpuIX815gdP+Iv5CTIfJMMT3Xu7EvR7ziBxg=; b=KtJ7B3OdbzK4ea37WqdzvLgzBQNh0KWyt0F0wbeOChwntmuU5RrtVO48B/+DR9fz9x bjG1pQoRgExu4Age0NMgi1bmtVjM6Hwbs9c0QWlF5T9IGKLAeIC97whgcq+iTYLKaE3b IHvc/tZqGpCMpQlahRSsAdCW1P4Scnxwhrlot9X58kKkG1JVIw5XsC53u67LpSVFBOZ3 rVQL7lKuYDV+vymZj35Wy92uZZLC53rfzN2btPZNE9lJ5trDsLZ7McIztkXAUry0Pxwy wq/ZU5ygGHcDjfS7jpQpPqC1FqOWXxYgbcQ9pADo/XQm3sYyoFv+ePcxjiCyMoErn3VB eDqg== X-Received: by 10.68.129.201 with SMTP id ny9mr16573747pbb.70.1392484347208; Sat, 15 Feb 2014 09:12:27 -0800 (PST) MIME-Version: 1.0 In-Reply-To: <87wqgwl4oo.fsf@elektro.pacujo.net> References: <13208de8-0f85-4e60-b059-dc087c8fda41@googlegroups.com> <917ede6d-db7c-4a8c-8203-27677283776b@googlegroups.com> <871tz5piy0.fsf@elektro.pacujo.net> <87vbwho1i0.fsf@elektro.pacujo.net> <87mwhtnzdu.fsf@elektro.pacujo.net> <87y51cn2m9.fsf@elektro.pacujo.net> <87mwhsn0nx.fsf@elektro.pacujo.net> <52ff4ce4$0$29973$c3e8da3$5496439d@news.astraweb.com> <87iosgmveg.fsf@elektro.pacujo.net> <52ff7cac$0$29973$c3e8da3$5496439d@news.astraweb.com> <87wqgwl4oo.fsf@elektro.pacujo.net> From: Ian Kelly Date: Sat, 15 Feb 2014 10:11:46 -0700 Subject: Re: Explanation of list reference To: Python Content-Type: text/plain; charset=ISO-8859-1 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: 61 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1392484350 news.xs4all.nl 2866 [2001:888:2000:d::a6]:55311 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:66457 On Sat, Feb 15, 2014 at 9:29 AM, Marko Rauhamaa wrote: > Steven D'Aprano : >> On Sat, 15 Feb 2014 14:07:35 +0200, Marko Rauhamaa wrote: >>> Steven D'Aprano : >>>> On Sat, 15 Feb 2014 12:13:54 +0200, Marko Rauhamaa wrote: >>>>> 5. id(x) == id(y) iff x is y >>>> >>>> # Counter-example >>>> py> x = 230000 >>>> py> idx = id(x) >>>> py> del x >>>> py> y = 420000 >>>> py> idy = id(y) >>>> py> idx == idy >>>> True >>> >>> I don't accept that as a counterexample. > >> Why? > > Nowhere do I see the violating "x is y". You formulated your rule as a rule of inference. The logical inference from the above is that x is y, which is false even if it can't be directly tested in Python. >> All I need to do is show a case where two distinct objects have the >> same ID. > > How do you know objects are "distinct"? Myself, I would use the "is" > test. Eliding over details of how one knows that both of the literals above create objects, if the objects are separately created, then they are distinct objects. >>> That's the point. I don't think id() and "is" have any abstract >>> meaning on top of the formal axioms. >> >> Who is talking about "abstract meaning"? > > I am. I mean, "implementation-independent". > >> Object identity is simple and well-defined in Python. I don't know why >> you are so resistant to this. Read the documentation. > > It is not defined at all: > > Every object has an identity, a type and a value. An object's > identity never changes once it has been created; you may think of it > as the object's address in memory. The 'is' operator compares the > identity of two objects; the id() function returns an integer > representing its identity. > > Thus "x and y are identical" *means* "x is y" and nothing else. This notion of identity sounds useless, and if that is the way you prefer to understand it then you can safely ignore that it exists. I think that most users though inherently understand the concept of objects being distinct or identical and see the value in being able to test for this.