Path: csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail From: Random832 Newsgroups: comp.lang.python Subject: Re: I'm wrong or Will we fix the ducks limp? Date: Sun, 05 Jun 2016 13:42:22 -0400 Lines: 64 Message-ID: References: <87mvn22veg.fsf@rudin.co.uk> <13108bea-6750-443b-bee8-0532aba8b338@googlegroups.com> <5753c89b$0$1616$c3e8da3$5496439d@news.astraweb.com> <1465148542.2670061.628500777.62F1EFE1@webmail.messagingengine.com> Mime-Version: 1.0 Content-Type: text/plain Content-Transfer-Encoding: 7bit X-Trace: news.uni-berlin.de QIFuK9MZhaDhqemyIVjaigT4Gwl6yT7qjC3VzWl22N1w== Return-Path: 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; 'python,': 0.02; 'operator': 0.03; 'value,': 0.03; 'objects,': 0.07; 'immutable': 0.09; 'objects)': 0.09; 'objects.': 0.09; 'pointers': 0.09; 'received:internal': 0.09; 'references,': 0.09; 'python': 0.10; 'itself.': 0.11; 'value.': 0.15; 'variables': 0.15; 'weird': 0.15; '"python': 0.16; 'bind': 0.16; 'dereference': 0.16; 'distinct': 0.16; 'invisible,': 0.16; 'message- id:@webmail.messagingengine.com': 0.16; 'obviously,': 0.16; 'received:10.202': 0.16; 'received:10.202.2': 0.16; 'received:10.202.2.212': 0.16; 'received:10.202.2.44': 0.16; 'received:66.111': 0.16; 'received:66.111.4': 0.16; 'received:compute4.internal': 0.16; 'received:io': 0.16; 'received:messagingengine.com': 0.16; 'received:psf.io': 0.16; 'wrote:': 0.16; "wouldn't": 0.16; 'example.': 0.18; 'language': 0.19; 'level,': 0.22; 'object.': 0.22; 'permitted': 0.22; 'programming': 0.22; '(or': 0.23; 'references': 0.23; 'implemented': 0.24; 'header:In-Reply-To:1': 0.24; 'sort': 0.25; 'example': 0.26; '(e.g.': 0.27; 'least': 0.27; 'object,': 0.27; 'tend': 0.27; 'values': 0.28; 'referenced': 0.29; 'strings,': 0.29; 'sure,': 0.29; 'objects': 0.29; 'anyone': 0.32; 'another': 0.32; 'holds': 0.32; 'statement': 0.32; 'point': 0.33; 'problem': 0.33; "d'aprano": 0.33; 'int': 0.33; 'steven': 0.33; 'execution': 0.35; 'false': 0.35; 'something': 0.35; 'but': 0.36; 'there': 0.36; 'to:addr:python-list': 0.36; 'subject:?': 0.36; 'subject:: ': 0.37; 'received:10': 0.37; 'two': 0.37; 'being': 0.37; 'agree': 0.37; 'detail': 0.38; 'difference': 0.38; 'received:66': 0.38; 'names': 0.38; 'means': 0.39; 'does': 0.39; 'subject:the': 0.39; 'to:addr:python.org': 0.40; 'where': 0.40; 'some': 0.40; 'your': 0.60; 'header:Message-Id:1': 0.61; 'no.': 0.62; '(that': 0.63; 'more': 0.63; 'different': 0.63; 'between': 0.65; "they're": 0.66; 'hey,': 0.75; 'analog': 0.84; 'confusing': 0.84; 'irrelevant': 0.84; 'have.': 0.93 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=fastmail.com; h= content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-sasl-enc :x-sasl-enc; s=mesmtp; bh=FMCAtGuSCa0LBn+waQW3YmpfWZ0=; b=RBCI4g 5ElC3taBg3Xd5JdBaazhnETUiBHAnWH0rrxj45/A6Ln8yKMSE9oO5u1QfU4Z7DEI a8Iml0cdnfAHDn+oe/0bqo971Y28ebW4oN7DF7K1sbE6M8AX8cjzqFjrCrOcyl5R GpB6OyHzXg7hRxJkxsvLKAecNEvtaRr0FzP88= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-sasl-enc:x-sasl-enc; s=smtpout; bh=FMCAtGuSCa0LBn+ waQW3YmpfWZ0=; b=f60ClAaDudHJA+nyDsi5yvlCafXgtQ47s88lmfIjX9RvESi SSyJbFemSQMrheiu3/cLQJo36eu5jp4trCZCEL8nMWh6iOmoPSU8IZdUDWLc0by/ dRlGwWYXMsxhnOEHEr66RhflyaKGUw3WCTl3+nqPYtN3+OKkLlT61KRxt9jw= X-Sasl-Enc: VSHWcicN16wniPoV6ApNY/fUl1dWVgbyI6ykDcsw7ED3 1465148542 X-Mailer: MessagingEngine.com Webmail Interface - ajax-2bd3df2b In-Reply-To: <5753c89b$0$1616$c3e8da3$5496439d@news.astraweb.com> X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Mailman-Original-Message-ID: <1465148542.2670061.628500777.62F1EFE1@webmail.messagingengine.com> X-Mailman-Original-References: <87mvn22veg.fsf@rudin.co.uk> <13108bea-6750-443b-bee8-0532aba8b338@googlegroups.com> <5753c89b$0$1616$c3e8da3$5496439d@news.astraweb.com> Xref: csiph.com comp.lang.python:109520 On Sun, Jun 5, 2016, at 02:37, Steven D'Aprano wrote: > No they don't. You are confusing the implementation with the programming > model. > > Following the assignment: > > x = 99 > > if you print(x), do you see something like "reference 0x12345"? No. > > Do you have to dereference that reference to get the value of x? No. > > At the Python level, the value of x is 99, not some invisible, > untouchable reference to 99. Sure, but that is the value of the object referenced by x, it is not a property of x itself. x = y = 999; z = int('999') x is y # True x is z # False How would you describe the difference between x and y, and z? This is not a mere implementation detail [though, the fact that for int in particular I had to go higher than 99 to get this result is - I wouldn't have had this problem with strings, and I *couldn't* have had this problem with lists]. The fact that two objects can have the same value while being different objects, and that two variables can point to the same object, are part of the programming model. Immutable objects do tend to blur the line, since implementations are permitted to make them the same even when they're apparently independent. The fact that == is an operator distinct from 'is' inherently means that variables contain references, not objects. There is, obviously, only one value in my example. If variables contained objects, then my example would have three objects, none more or less distinct. They contain references, and that is the only way there are two objects, and that is the only model in which there are two of anything. [but, hey, at least we can agree that Python has variables.] > There is no analog to dereferencing in Python, nothing like print(x^). I don't see where anyone said there was. I think you've inferred meaning to the statement "python variables contain references" that it does not actually have. > You bind values (that is, objects) Values are not objects. x and z have the same value, and their objects are identical but distinct, but they are different because they point (or refer, or by your weird terminology "bind") to different objects. > directly to names, and names (variables) hold their value, not a > reference to their value. They hold a reference to an object. The object holds the value. > The fact that for some implementations that is implemented using > references of some sort or another (e.g. pointers in CPython) is an > implementation detail which is irrelevant to the language and its > execution model.