Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.albasani.net!rt.uk.eu.org!newsfeed.xs4all.nl!newsfeed4a.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.019 X-Spam-Evidence: '*H*': 0.96; '*S*': 0.00; 'yet.': 0.04; 'argument': 0.05; '*not*': 0.07; 'though:': 0.07; '*is*': 0.09; 'cc:addr :python-list': 0.11; 'cease': 0.16; 'created.': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'variables,': 0.16; 'language': 0.16; 'wrote:': 0.18; 'variable': 0.18; 'module': 0.19; 'cc:addr:python.org': 0.22; "aren't": 0.24; 'exists': 0.24; 'cc:2**0': 0.24; 'header:In-Reply-To:1': 0.27; 'correct': 0.29; 'am,': 0.29; 'message-id:@mail.gmail.com': 0.30; "i'm": 0.30; '(although': 0.31; 'about.': 0.31; 'received:google.com': 0.35; 'anything': 0.39; 'delete': 0.39; 'even': 0.60; 'new': 0.61; 'simple': 0.61; 'name': 0.63; 'talking': 0.65; 'sound': 0.68; 'confirmed,': 0.84; 'ethan': 0.84; 'furman': 0.84; 'shadow': 0.84; 'to:none': 0.92; 'responses': 0.93 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:cc :content-type; bh=5rhJLCcNpW8ABh1rUZRslmGbPZXLqsGcX8fFgNopl48=; b=DXC9jD/nZGtGUnI6p+vRsENpB3ovGTD+l53kUIX8fHETaYAzk5VEfebQc1npvsio6J v2+KX0L7RhE2djd+HiPSl+eQtrQ5VPVySsfgnFjY7puhFxeTcwcCapIOAC8tQweH6eHI zM7LKqUDX14T0/MyzvyrxaESZtXfFPJH467Nrcm8LT1bwEpv2RWZI3AT/v93owlvP/En 29/CQbjAY4zbUzjtMzrnUcWWb1kNSQF1Qa20HC4ctr7oF6muvqpq3UixJXqfxD4mtfcQ oIfszkiyVmIYDuTLe61qNhDvm+fTSQH5JW+3E8bmNC9x7r5K+gmPKAxHH6rjq3Fi3/fs G5Lw== MIME-Version: 1.0 X-Received: by 10.52.125.147 with SMTP id mq19mr1201281vdb.2.1399763914639; Sat, 10 May 2014 16:18:34 -0700 (PDT) In-Reply-To: <536E799D.6080602@stoneleaf.us> References: <235C4BFA-9770-481A-9FCF-21C3F036769C@gmail.com> <5368681D.8070602@islandtraining.com> <87ppjpwafk.fsf@elektro.pacujo.net> <536ad8f2$0$29965$c3e8da3$5496439d@news.astraweb.com> <87zjiqbmy5.fsf@elektro.pacujo.net> <536d7a7d$0$29980$c3e8da3$5496439d@news.astraweb.com> <9cc0ebf9-dbed-4d3d-91fc-2abb9b0103d0@googlegroups.com> <536dc3f7$0$29980$c3e8da3$5496439d@news.astraweb.com> <536decca$0$29980$c3e8da3$5496439d@news.astraweb.com> <536E799D.6080602@stoneleaf.us> Date: Sun, 11 May 2014 09:18:34 +1000 Subject: Re: Values and objects From: Chris Angelico Cc: "python-list@python.org" Content-Type: text/plain; charset=UTF-8 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: 24 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1399764312 news.xs4all.nl 2917 [2001:888:2000:d::a6]:53876 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:71278 On Sun, May 11, 2014 at 5:10 AM, Ethan Furman wrote: > And if you don't like that argument (although it is a perfectly sound and > correct argument), think of the module name space: > > > ret = spam > spam = 23 > > will net you a simple NameError, because spam has not yet been created. What about this, though: ret = int int = 23 That will *not* net you a NameError, because 'int' exists in an outer scope (builtins). You can create a new module-scope variable and it will immediately begin to shadow a builtin; you can delete that variable and it will immediately cease to shadow that builtin. That's the difference I'm talking about. With function-local variables, they all have to exist (as other responses confirmed, that *is* a language guarantee), even though some of them aren't bound to anything yet. ChrisA