Path: csiph.com!news.mixmin.net!feeds.phibee-telecom.net!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; 'exist,': 0.07; 'works.': 0.07; 'url:pycon': 0.08; '*name*': 0.09; '[1]:': 0.09; 'ambiguity': 0.09; 'cached': 0.09; 'garbage': 0.09; 'immutable': 0.09; 'incorrect': 0.09; 'issue:': 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; 'python.': 0.11; 'explicitly': 0.15; 'variables': 0.15; '*a*': 0.16; '*a*,': 0.16; '*never*': 0.16; 'containers': 0.16; 'i.e.,': 0.16; 'investigate': 0.16; 'labelled': 0.16; 'objects).': 0.16; 'pairs': 0.16; 'quantum': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'subject:reference': 0.16; 'subject:versus': 0.16; 'url:%22': 0.16; 'url:display': 0.16; 'url:py': 0.16; 'drawing': 0.18; 'exists': 0.18; 'language': 0.19; '>>>': 0.20; '(the': 0.22; 'ascii': 0.22; 'disable': 0.22; 'explicit': 0.22; 'names.': 0.22; 'object.': 0.22; 'programming': 0.22; 'defined': 0.23; 'seems': 0.23; 'wrote': 0.23; '(you': 0.23; 'references': 0.23; 'represents': 0.23; 'header:User-Agent:1': 0.26; "doesn't": 0.26; 'header:X-Complaints-To:1': 0.26; '[2]': 0.27; 'correct': 0.28; '"do': 0.29; 'question:': 0.29; 'objects': 0.29; "i'm": 0.30; "i'd": 0.31; "can't": 0.32; '[1]': 0.32; 'url:python': 0.33; 'common': 0.33; 'url:%4': 0.33; 'message- id:@gmail.com': 0.34; 'case,': 0.34; 'add': 0.34; 'lists': 0.34; 'list': 0.34; 'could': 0.35; 'clear': 0.35; 'exist': 0.35; 'lists.': 0.35; 'something': 0.35; 'but': 0.36; 'should': 0.36; 'instead': 0.36; 'there': 0.36; 'created': 0.36; 'subject:" ': 0.36; 'to:addr:python-list': 0.36; 'subject:: ': 0.37; 'really': 0.37; 'two': 0.37; 'method': 0.37; 'received:org': 0.37; 'difference': 0.38; 'names': 0.38; 'wrong': 0.38; 'mean': 0.38; 'represent': 0.38; 'why': 0.39; 'sure': 0.39; 'does': 0.39; 'rather': 0.39; 'to:addr:python.org': 0.40; 'still': 0.40; 'collection': 0.60; 'term': 0.60; 'url:3': 0.60; 'your': 0.60; 'claim': 0.61; 'identify': 0.61; 'show': 0.62; 'here.': 0.62; 'different': 0.63; 'complete': 0.63; 'within': 0.64; 'circle': 0.66; 'url:6': 0.66; 'url:js': 0.66; 'here': 0.66; 'talking': 0.67; 'therefore': 0.67; 'notice:': 0.69; 'picture': 0.70; 'received:89': 0.80; 'answer:': 0.84; 'boxes.': 0.84; 'url:2007': 0.84; 'url:a1': 0.84; 'url:false': 0.84; 'url:mode': 0.84; 'url:origin': 0.84; 'url:%0a': 0.91 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Akira Li <4kir4.1i@gmail.com> Subject: Re: Terminology: "reference" versus "pointer" Date: Mon, 14 Sep 2015 02:17:53 +0300 References: <55F36B4C.9020007@gmail.com> <1442016698.95299.381478313.2487CA0E@webmail.messagingengine.com> <85mvws6z45.fsf_-_@benfinney.id.au> <85io7g6xy4.fsf@benfinney.id.au> <85egi46wng.fsf@benfinney.id.au> <1a1a1f6a-27ce-4c1b-807a-43eabaa04abb@googlegroups.com> <04ca9d7c-d02b-4329-bd94-4d18d86b3edf@googlegroups.com> <87egi375wb.fsf@gmail.com> <87wpvu5h7f.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain X-Gmane-NNTP-Posting-Host: 89.169.229.68 User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4 (gnu/linux) Cancel-Lock: sha1:RyVD4SzqpdUVjY9fouK+aCpU/yg= 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: 89 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1442186367 news.xs4all.nl 23810 [2001:888:2000:d::a6]:46994 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:96532 Random832 writes: > Akira Li <4kir4.1i@gmail.com> writes: >> I'm not sure what "parcel tags" model is but if you mean these >> pictures[1] than it works in this case as well as any other (take *a*, >> *b* nametags, put them on the corresponding balloons that represents >> list objects). >> >> The only names left are *a* and *b* that refer to the corresponding >> lists. There is no ambiguity there to put *a*, *b* nametags. > > But how do you make an a[0][0]/a[1][0] nametag to put on the "1" object? a[0][0]/a[1][0] are not names. Though if we want to talk about the corresponding objects then a[0][0]/a[1][0] could be used instead of names (as a way to identify them). >> Lists as any other containers contain references to other objects and >> therefore "box and arrows" model provides _more details_ here[2,3] > > Right, but why not use the *same* model to represent *namespaces*? If it works for your case; use it. The links [2,3] show that It does work in this case (if it is correct to call what they show "box and arrows" model). > It seems like the "tags" model only exists to make the incorrect claim > that python doesn't have variables (the boxes are variables). If you mean this quote from [1]: Although we commonly refer to "variables" even in Python (because it's common terminology), we really mean "names" or "identifiers". In Python, "variables" are nametags for values, not labelled boxes. then *name* is the term that is defined in the Python language reference. The word "variable" we can use in day-to-day programming _unless_ we are discussing issues that are specific to _naming and binding_. In that case, we should use the _exact_ terminology. Otherwise there is nothing wrong with using "variables" casually in Python. Notice: that [2,3] model is different from "labelled boxes" model. There are arrows from *a*/*b* _to_ list objects i.e., *a*/*b* are not boxes that _contain_ list objects within -- _otherwise you have to put the *same* list into two *different* boxes_ -- let's not investigate quantum paradoxes here. The only difference from "parcel tags" model is that list items do not have explicit names. >>> If the "parcel tags" model can't show it, then the "parcel tag" model >>> clearly is not a correct and complete depiction of how Python actually >>> works. >>> (If I were drawing a picture rather than ASCII I'd add something to make >>> it clear that the pairs shown are list objects Like, it's a circle with >>> the word "list" and two pointer-boxes inside it.) >> >> "correct and complete" is impossible in the general case for any >> model. > > Everything you wrote here has the same issue: The "objects" you are > talking about do not physically exist, but are simply the result of > calling a method on the object. Therefore they do not *belong* on the > diagram, and the diagram not showing them does not mean the diagram is > not complete. "do not physically exist" does not make sense. Objects are *never* destroyed explicitly in Python (you can only make them *unreachable*). You can disable garbage collection completely and it is still will be Python. Immutable objects can be considered immortal e.g.: (1+1) -- question: does the object that represents int(2) exist before the expression is evaluated? The correct answer: it does not matter: int(2) can be created on the fly, a cached int(2) can be reused by a specific implementation -- Python doesn't care. I don't see why the model that can't describe range(1) in Python 3 pretends to be complete. [1] http://python.net/~goodger/projects/pycon/2007/idiomatic/handout.html#python-has-names [2] http://www.pythontutor.com/visualize.html#code=a0+%3D+a1+%3D+%5B1,+2%5D%0Ab0+%3D+%5B1,+2%5D%0Ab1+%3D+%5B1,+2%5D%0Aa+%3D+%5Ba0,+a1%5D%0Ab+%3D+%5Bb0,+b1%5D%0Adel+a0,+a1,+b0,+b1%0A&mode=display&origin=opt-frontend.js&cumulative=false&heapPrimitives=false&textReferences=false&py=3&rawInputLstJSON=%5B%5D&curInstr=6 [3] http://www.pythontutor.com/visualize.html#code=a0+%3D+a1+%3D+%5B1,+2%5D%0Ab0+%3D+%5B1,+2%5D%0Ab1+%3D+%5B1,+2%5D%0Aa+%3D+%5Ba0,+a1%5D%0Ab+%3D+%5Bb0,+b1%5D%0Adel+a0,+a1,+b0,+b1%0Aa%5B0%5D%5B0%5D+%3D+%22Oops!%22&mode=display&origin=opt-frontend.js&cumulative=false&heapPrimitives=false&textReferences=false&py=3&rawInputLstJSON=%5B%5D&curInstr=7