Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.albasani.net!rt.uk.eu.org!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.001 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'programmer': 0.03; 'represents': 0.05; 'subject:Python': 0.06; 'memory.': 0.07; 'table.': 0.07; "'.'": 0.09; 'from:addr:ethan': 0.09; 'from:addr:stoneleaf.us': 0.09; 'from:name:ethan furman': 0.09; 'message-id:@stoneleaf.us': 0.09; 'namespace': 0.09; '~ethan~': 0.09; 'python': 0.11; 'dict': 0.16; 'namespace,': 0.16; 'namespace.': 0.16; 'received:69.93': 0.16; 'reedy': 0.16; 'wrote:': 0.18; 'code.': 0.18; 'variable': 0.18; 'producing': 0.19; 'thu,': 0.19; '>>>': 0.22; 'header:User-Agent:1': 0.23; 'pointer': 0.24; 'holds': 0.26; 'second': 0.26; '(for': 0.26; 'values': 0.27; 'header:In-Reply-To:1': 0.27; 'idea': 0.28; 'function': 0.29; 'correct': 0.29; 'array': 0.29; '(used': 0.31; '>>>>': 0.31; 'calculated': 0.31; 'constant': 0.31; 'allows': 0.31; 'case,': 0.35; 'object,': 0.36; 'level': 0.37; 'to:addr :python-list': 0.38; 'pm,': 0.38; 'previous': 0.38; 'to:addr:python.org': 0.39; 'either': 0.39; 'tell': 0.60; 'received:173': 0.61; 'first': 0.61; 'name': 0.63; 'subject:The': 0.64; 'talking': 0.65; 'subjectcharset:utf-8': 0.72; 'grow': 0.77; 'subject:have': 0.80; '(always': 0.84; 'concept.': 0.84; 'dict,': 0.84 Date: Thu, 08 May 2014 15:36:55 -0700 From: Ethan Furman User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:16.0) Gecko/20121010 Thunderbird/16.0.1 MIME-Version: 1.0 To: python-list@python.org Subject: Re: The =?UTF-8?B?4oCcZG9lcyBQeXRob24gaGF2ZSB2YXJpYWJsZXM/4oCdIGQ=?= =?UTF-8?B?ZWJhdGU=?= References: <235C4BFA-9770-481A-9FCF-21C3F036769C@gmail.com> <5368681D.8070602@islandtraining.com> <85zjiuea37.fsf_-_@benfinney.id.au> <8738gmxgay.fsf@elektro.pacujo.net> <87tx91warf.fsf@elektro.pacujo.net> <85eh05cdjx.fsf@benfinney.id.au> <536B3B2F.8060200@m4x.org> <87lhuct4qk.fsf@elektro.pacujo.net> In-Reply-To: <87lhuct4qk.fsf@elektro.pacujo.net> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - gator3304.hostgator.com X-AntiAbuse: Original Domain - python.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - stoneleaf.us X-BWhitelist: no X-Source-IP: 173.12.184.233 X-Exim-ID: 1WiWvv-0001VT-WA X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: ([173.12.184.233]) [173.12.184.233]:60013 X-Source-Auth: ethan+stoneleaf.us X-Email-Count: 1 X-Source-Cap: dG9idWs7dG9idWs7Z2F0b3IzMzA0Lmhvc3RnYXRvci5jb20= 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: 30 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1399591581 news.xs4all.nl 2846 [2001:888:2000:d::a6]:45134 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:71134 On 05/08/2014 01:06 PM, Marko Rauhamaa wrote: > Terry Reedy : > >>> On Thu, May 8, 2014 at 6:07 PM, Joseph Martinot-Lagarde >>> wrote: >>>> For me, names bound to values is the same concept as pointer >>>> pointing to memory. >> >> You are missing a level of indirection. In CPython, a name (always in >> some namespace) represents a pointer to a pointer. The first pointer >> is calculated as an offset from the base pointer of the namespace. For >> a C array namespace (used for functions), the offset is constant (for >> that function and namespace). For a python dict namespace, the offset >> is calculated from the hash of the name, the size of the dict, and the >> previous contents of the hash table. This complication allows the >> namespace to grow and shrink. In either case, the second pointer if >> overwritten to 'rebind' the name. > > Terry, you are talking about an implementation. Joseph is talking about > the concept. > > You can tell a C programmer that a Python variable always holds a > pointer to an object, and they get the idea right away ("Oh, so '.' in > Python is the same as '->' in C") and start producing efficient, correct > Python code. Right up until they want to dereference. -- ~Ethan~