Path: csiph.com!news.mixmin.net!newsreader4.netcologne.de!news.netcologne.de!bcyclone01.am1.xlned.com!bcyclone01.am1.xlned.com!newsfeed.xs4all.nl!newsfeed8.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.002 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'subject:Python': 0.05; 'cpython': 0.05; '"a"': 0.09; 'garbage': 0.09; 'immutable': 0.09; 'received:internal': 0.09; 'python': 0.10; 'interpreter': 0.15; 'assigns': 0.16; 'count,': 0.16; 'message- id:@webmail.messagingengine.com': 0.16; 'received:10.202': 0.16; 'received:10.202.2': 0.16; 'received:10.202.2.212': 0.16; 'received:66.111': 0.16; 'received:66.111.4': 0.16; 'received:messagingengine.com': 0.16; 'wrote:': 0.16; 'pointer': 0.18; 'assign': 0.22; 'sep': 0.22; 'header:In-Reply-To:1': 0.24; 'fri,': 0.27; 'object,': 0.27; 'work.': 0.30; 'statement': 0.32; 'michael': 0.33; '(and': 0.36; 'keyword': 0.36; 'to:addr:python- list': 0.36; 'subject:: ': 0.37; 'received:10': 0.37; 'received:66': 0.38; 'does': 0.39; 'rather': 0.39; 'to:addr:python.org': 0.40; 'called': 0.40; 'from:no real name:2**0': 0.60; 'care': 0.60; 'skip:u 10': 0.61; 'header :Message-Id:1': 0.61; 'secret': 0.72; 'works)': 0.84 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=fastmail.us; h= content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-sasl-enc :x-sasl-enc; s=mesmtp; bh=YZURipxfcWik44YZ5Z9JUWv2+rc=; b=FOYjtj ADiGHrCSRCRjzYh8C8eOPFz6aXYpxNeVUubLOqmo8yu2Srw+D+mg2zAo6vOj+tD+ Mz6r+SeOiY0dJYacbKdMeECp4NPg79GVKyL26UqK37HDscihz6ntvYe++sDR9bIY fn619HZ8RV4AkljJcEwxNCNtJpK+P23oHQxl4= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-sasl-enc:x-sasl-enc; s=smtpout; bh=YZURipxfcWik44Y Z5Z9JUWv2+rc=; b=laaKWYkPeVxjUr/gwv9E7puV39IZ8On2eGfJLtOf31hPex9 zJmvSmBEQX3to9jyRgPEkTIrjw7dWm7XYvQ/B5NIorZdyl1RmmSwA+5poJXRx0J6 xroyz850BILhlhDAJ2DA/xANZsM6fk7Ca9NEykNZVVlg/GDYhe5ELdLCKHYk= X-Sasl-Enc: ycDVNzFZtcrpFl18Kxws+4aOeurg3z/Icbk6seqs46sV 1442016698 From: random832@fastmail.us To: python-list@python.org MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain X-Mailer: MessagingEngine.com Webmail Interface - ajax-c76b43ce Subject: Re: Python handles globals badly. Date: Fri, 11 Sep 2015 20:11:38 -0400 In-Reply-To: <55F36B4C.9020007@gmail.com> References: <14afe27e-0bd5-410f-8e64-0f31d496ebf2@googlegroups.com> <55F36B4C.9020007@gmail.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: 10 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1442016701 news.xs4all.nl 23732 [2001:888:2000:d::a6]:57206 X-Complaints-To: abuse@xs4all.nl X-Received-Bytes: 4119 X-Received-Body-CRC: 1922032516 Xref: csiph.com comp.lang.python:96376 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)