Path: csiph.com!eternal-september.org!feeder.eternal-september.org!border1.nntp.ams1.giganews.com!nntp.giganews.com!newsfeed.xs4all.nl!newsfeed7.news.xs4all.nl!nzpost1.xs4all.net!not-for-mail 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; 'value,': 0.03; '*not*': 0.07; 'assignment': 0.07; 'variable,': 0.07; '*is*': 0.09; 'changed;': 0.09; 'ignoring': 0.09; 'implies': 0.09; 'pointers': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'python': 0.10; 'value.': 0.15; '"value"': 0.16; '(there': 0.16; 'c++.': 0.16; 'created.': 0.16; 'describing': 0.16; 'distinct': 0.16; 'mean,': 0.16; 'python),': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'somewhere.': 0.16; 'subject:versus': 0.16; 'with?': 0.16; 'pointer': 0.18; 'refers': 0.18; 'variable': 0.18; 'do.': 0.22; 'assign': 0.22; 'c++,': 0.22; 'implicit': 0.22; 'object.': 0.22; 'fit': 0.23; 'references': 0.23; 'header:User-Agent:1': 0.26; 'header:X-Complaints-To:1': 0.26; 'switch': 0.27; 'said,': 0.27; 'values': 0.28; 'references.': 0.29; 'return;': 0.29; 'sure,': 0.29; 'program,': 0.29; 'that.': 0.30; 'normally': 0.30; 'another': 0.32; "can't": 0.32; 'statement': 0.32; 'accessible': 0.33; 'clarify': 0.33; 'received:comcast.net': 0.33; 'reference,': 0.33; 'running': 0.34; 'something': 0.35; "isn't": 0.35; 'but': 0.36; 'to:addr:python- list': 0.36; 'subject:: ': 0.37; 'received:org': 0.37; 'difference': 0.38; 'copying': 0.38; 'does': 0.39; 'to:addr:python.org': 0.40; 'term': 0.60; 'address': 0.61; 'skip:u 10': 0.61; 'yes': 0.62; 'making': 0.62; 'different': 0.63; 'fundamental': 0.66; "they're": 0.66; 'direct': 0.68; 'skip:\xe2 10': 0.70; 'subjectcharset:utf-8': 0.71; '8bit%:46': 0.76; 'huh?': 0.84; 'subject::': 0.85; 'am.': 0.91 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Random832 Subject: Re: Terminology: =?utf-8?B?4oCccmVmZXJlbmNl4oCd?= versus =?utf-8?B?4oCccG9pbnRlcuKAnQ==?= Date: Sat, 12 Sep 2015 01:03:26 -0400 References: <14afe27e-0bd5-410f-8e64-0f31d496ebf2@googlegroups.com> <55F36B4C.9020007@gmail.com> <1442016698.95299.381478313.2487CA0E@webmail.messagingengine.com> <85mvws6z45.fsf_-_@benfinney.id.au> <85io7g6xy4.fsf@benfinney.id.au> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Gmane-NNTP-Posting-Host: c-68-39-146-59.hsd1.in.comcast.net User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (darwin) Cancel-Lock: sha1:sVx7uLQkEedyx8Tmi9rv/y/f+yI= X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.20+ 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: 54 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1442034217 news.xs4all.nl 23791 [2001:888:2000:d::a6]:55567 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:96400 Ben Finney writes: > Random832 writes: > >> Ben Finney writes: >> > With the significant difference that “pointer” implies that it has its >> > own value accessible directly by the running program, such as a pointer >> > in C. >> >> Its own value *is* what you're accessing when you assign or return it. > > You're not describing Python references. Yes I am. You're just making the implicit assumption that a "value" has to be a number, and I was ignoring that assumption. The value is the address of an object. Like I said, an arrow on a diagram. > Can you clarify what you mean, and what in my description you are > disagreeing with? > >> > That's different from a “reference”, which to my understanding >> > implies the running program does *not* normally have direct access >> > to it as a distinct value. The only way you can use a reference is >> > to get at the object to which it refers. >> >> In C++, references cannot be reassigned. I consider *that* the >> fundamental difference - a pointer is a variable that you can reassign >> and return; a reference always refers to the same object once created. > > Sure, that will work fine. > > So in Python, we don't have pointers because we don't have access to > change or reassign them. Yes you do. That's _exactly what happens_ in an assignment statement - you are reassigning it to the address of another object. And that's something you *can't do* with references in C++. Neither term is perfect, but "reference" is a *terrible* fit because of that. > A Python reference isn't accessible and can't be changed; you can just > make another reference and switch to that. Huh? > You can't, for example, keep the old reference (there are no references > to references in Python), because they're not accessible as values in > themselves. Once you assign a different reference, the old one is gone > and can't be found again. You can keep it by copying it to somewhere. The pointer is the value, not the variable, you don't _need_ a reference to it.