Path: csiph.com!goblin1!goblin.stu.neva.ru!uio.no!news.tele.dk!news.tele.dk!small.news.tele.dk!newsgate.cistron.nl!newsgate.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.001 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'cpython': 0.05; 'indicating': 0.05; 'memory.': 0.05; 'bits': 0.07; 'defines': 0.07; 'bits.': 0.09; 'c/c++': 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; 'language,': 0.11; 'value.': 0.15; '"well,': 0.16; 'at.': 0.16; 'pointer,': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'subject:reference': 0.16; 'subject:versus': 0.16; 'wrote:': 0.16; 'integer': 0.18; 'pointer': 0.18; '>>>': 0.20; '2015': 0.20; "aren't": 0.22; 'constant': 0.22; 'object.': 0.22; 'sep': 0.22; 'programming': 0.22; 'am,': 0.23; 'sat,': 0.23; 'header:In-Reply-To:1': 0.24; 'header:User-Agent:1': 0.26; 'header:X-Complaints-To:1': 0.26; 'points': 0.27; 'arithmetic': 0.29; 'dictionary': 0.29; 'quoting': 0.29; 'objects': 0.29; "can't": 0.32; 'screen': 0.32; 'computing': 0.32; 'language.': 0.32; 'maybe': 0.33; 'point': 0.33; 'url:python': 0.33; "d'aprano": 0.33; 'steven': 0.33; 'definition': 0.34; 'editor': 0.34; 'so,': 0.35; 'text': 0.35; 'there': 0.36; 'url:org': 0.36; 'subject:" ': 0.36; 'url:library': 0.36; 'to:addr:python-list': 0.36; 'pm,': 0.36; 'subject:: ': 0.37; 'two': 0.37; 'received:org': 0.37; '12,': 0.37; 'seem': 0.37; 'data': 0.39; 'does': 0.39; 'to:addr:python.org': 0.40; 'term': 0.60; 'url:3': 0.60; 'press': 0.61; 'address': 0.61; 'black': 0.61; 'charset:windows-1252': 0.62; 'skip:n 10': 0.62; 'saturday,': 0.63; 'guaranteed': 0.67; 'address,': 0.77; 'received:12': 0.81; 'black,': 0.84; 'distinguish': 0.84; 'flipping': 0.84; 'url:functions': 0.84; 'utc+5:30,': 0.84; 'white,': 0.84 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Emile van Sebille Subject: Re: Terminology: "reference" versus "pointer" Date: Sat, 12 Sep 2015 10:14:05 -0700 References: <14afe27e-0bd5-410f-8e64-0f31d496ebf2@googlegroups.com> <55F36B4C.9020007@gmail.com> <1442016698.95299.381478313.2487CA0E@webmail.messagingengine.com> <85mvws6z45.fsf_-_@benfinney.id.au> <55f45396$0$1660$c3e8da3$5496439d@news.astraweb.com> <1dabdb08-2aee-4a53-bb57-1410edd372f6@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-Gmane-NNTP-Posting-Host: www.westernstatesglass.com User-Agent: Mozilla/5.0 (Windows NT 6.2; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.2.0 In-Reply-To: <1dabdb08-2aee-4a53-bb57-1410edd372f6@googlegroups.com> 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: 53 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1442078061 news.xs4all.nl 23802 [2001:888:2000:d::a6]:33197 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:96437 On 9/12/2015 9:54 AM, Rustom Mody wrote: > On Saturday, September 12, 2015 at 10:02:40 PM UTC+5:30, Steven D'Aprano wrote: >> On Sat, 12 Sep 2015 02:42 pm, Random832 wrote: >> >>> Anyway, maybe we do need a term to distinguish Python/C#/Java pointers >>> from C/C++ pointers - maybe call it a "non-arithmetic" pointer, since >>> the key thing about it is you can't do pointer arithmetic on them to get >>> the object "next to" the one it points at. >> >> How about *just don't call them pointers*? You know, since they aren't >> pointers in the computer science sense. >> >> The Free On-line Dictionary of Computing defines "pointer": >> >> 1. An address, from the point of view of a >> programming language. A pointer may be typed, with its type >> indicating the type of data to which it points. > > > >> Insisting that Python has pointers is like insisting that you use a text >> editor by flipping bits. "What happens if I press Ctrl-X?" "Well, these >> bits on the screen flip from black to white, these bits flip from white to >> black, and these stay the same." >> > > This is from the docs > https://docs.python.org/3/library/functions.html#id > > id(object) > > Return the "identity" of an object. This is an integer which is guaranteed to be unique and constant for this object during its lifetime. Two objects with non-overlapping lifetimes may have the same id() value. > > CPython implementation detail: This is the address of the object in memory. Quoting from above: >> The Free On-line Dictionary of Computing defines "pointer": >> >> 1. An address, from the point of view of a >> programming language. So, how does the CPython program access the contents given its 'address in memory'? From the definition it would seem it's not a pointer, as from the perspective of the programming language, you can't get there from the id. Look-ma,-no-pointers-ly y'rs, Emile