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!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; 'subject:Python': 0.05; 'cpython': 0.05; 'from:addr:yahoo.co.uk': 0.05; '"a"': 0.09; 'garbage': 0.09; 'immutable': 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; 'interpreter': 0.15; 'assigns': 0.16; 'count,': 0.16; 'ironpython': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'wrote:': 0.16; 'pointer': 0.18; 'language': 0.19; 'assign': 0.22; 'lawrence': 0.22; 'sep': 0.22; 'header:In-Reply-To:1': 0.24; 'header:User-Agent:1': 0.26; 'header:X-Complaints-To:1': 0.26; 'fri,': 0.27; 'object,': 0.27; 'work.': 0.30; 'especially': 0.32; 'language.': 0.32; 'statement': 0.32; 'michael': 0.33; '(and': 0.36; 'keyword': 0.36; 'to:addr:python-list': 0.36; 'subject:: ': 0.37; 'received:org': 0.37; 'does': 0.39; 'rather': 0.39; 'to:addr:python.org': 0.40; 'mark': 0.40; 'called': 0.40; 'care': 0.60; 'skip:u 10': 0.61; 'charset:windows-1252': 0.62; 'our': 0.64; 'secret': 0.72; 'pythonistas,': 0.84; 'works)': 0.84 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Mark Lawrence Subject: Re: Python handles globals badly. Date: Sat, 12 Sep 2015 03:57:22 +0100 References: <14afe27e-0bd5-410f-8e64-0f31d496ebf2@googlegroups.com> <55F36B4C.9020007@gmail.com> <1442016698.95299.381478313.2487CA0E@webmail.messagingengine.com> Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-Gmane-NNTP-Posting-Host: 195.147.66.69 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.2.0 In-Reply-To: <1442016698.95299.381478313.2487CA0E@webmail.messagingengine.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: 22 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1442026656 news.xs4all.nl 23761 [2001:888:2000:d::a6]:54361 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:96386 On 12/09/2015 01:11, random832@fastmail.us wrote: > On Fri, Sep 11, 2015, at 20:01, Michael Torrie wrote: >> The secret to understanding the global keyword is to understand how >> Python namespaces work. The statement "a=5" does not assign a 5 to the >> box called "a." Rather it binds the name "a" to the "5" object, which >> is immutable and called into existence by the interpreter >> implementation. > > In other words, it assigns a pointer to the "5" object [otherwise known > as "a 5"] to the box called "a". (And increments its reference count, if > you care about how the CPython garbage collector works) > If everything in Python is an object, how can it assign a pointer? Especially how do Jython and IronPython assign pointers? -- My fellow Pythonistas, ask not what our language can do for you, ask what you can do for our language. Mark Lawrence