Path: csiph.com!goblin1!goblin.stu.neva.ru!uio.no!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.029 X-Spam-Evidence: '*H*': 0.94; '*S*': 0.00; 'subject:Python': 0.05; 'variable,': 0.07; 'applies': 0.15; "hasn't": 0.15; 'thu,': 0.15; 'opposite': 0.16; 'scope.': 0.16; 'wrote:': 0.16; 'nested': 0.18; "shouldn't": 0.18; '>>>': 0.20; '2015': 0.20; "aren't": 0.22; 'lawrence': 0.22; 'sep': 0.22; 'code.': 0.23; 'fit': 0.23; 'header :In-Reply-To:1': 0.24; "i've": 0.25; 'message-id:@mail.gmail.com': 0.27; 'var': 0.27; 'function': 0.28; "i'm": 0.30; 'probably': 0.31; 'anyone': 0.32; 'url:python': 0.33; 'curious': 0.33; 'file': 0.34; 'this?': 0.34; 'received:google.com': 0.35; 'but': 0.36; 'url:org': 0.36; '(and': 0.36; 'to:addr:python-list': 0.36; 'pm,': 0.36; 'subject:: ': 0.37; 'really': 0.37; 'sure': 0.39; 'does': 0.39; 'to:addr:python.org': 0.40; 'mark': 0.40; 'url:3': 0.60; 'entire': 0.61; 'safe': 0.63; 'dont': 0.64; 'elsewhere': 0.66; 'outermost': 0.84; 'to:name:python': 0.84; 'url:reference': 0.91 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; bh=h8bS6nJoY6Y+ArwX3Wj4zoYOvvC+8QVVy/5SXuKAAqI=; b=lBQeSqNi1hsXa+0t8E8m0lKckRjXX8zBCu2wwctotW3d5nNEWVdmL1ACbVO8KKGlPU k+hPMm8p+n2oISZS/n+uh0eFGrPfGDXgwxrKq7ngKEQtP6rudsd9biPXhH2+uGPcxzAr S6qTgKT8stIYYBJMByq1hCegCZBQwJDBFBRsh3yIMqU8CYLgsDlj6kCEjxfI3XI2iRtc fod4ER4oDwfjKCwO8IbqXCzgP9JelEgzCBvGXnd6bPGEHVe5HGTwgCsc++yGBB9nzGO3 KfoPokzoQaENfHfUTeZNuX/KlIEbbUpZLtsNWuRDXFDpWkSqXwYu/P2yalUxJnB84/v6 A1+A== X-Received: by 10.129.31.135 with SMTP id f129mr412572ywf.85.1441320377519; Thu, 03 Sep 2015 15:46:17 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: References: <4602a32c-5109-47dd-95bb-b9723738f07f@googlegroups.com> From: Ian Kelly Date: Thu, 3 Sep 2015 16:45:37 -0600 Subject: Re: Python handles globals badly. To: Python Content-Type: text/plain; charset=UTF-8 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: 23 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1441320380 news.xs4all.nl 23758 [2001:888:2000:d::a6]:50535 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:95978 On Thu, Sep 3, 2015 at 4:13 PM, Mark Lawrence wrote: > On 03/09/2015 20:47, Ian Kelly wrote: >> >> On Thu, Sep 3, 2015 at 1:05 PM, wrote: >>> >>> Or does anyone really name a global var xxx and a function var xxx? >>> I am sure no one at all will do it. I dont want read such a code. >> >> >> Intentionally, it's probably rare. But if I'm adding a new variable, I >> shouldn't need to first make sure that it's safe to do so by scanning >> over the entire file to make sure that the name hasn't already been >> used elsewhere in the opposite scope. >> > > I'm just curious as I've never used it myself, but how does nonlocal > https://docs.python.org/3/reference/simple_stmts.html#the-nonlocal-statement > fit into this? I don't know whether the proposal also applies to nonlocals, but such conflicts would be less of an issue since you would only need to check the outermost function scope (and also, nested functions aren't really all that common).