Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #95978

Re: Python handles globals badly.

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 <ian.g.kelly@gmail.com>
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 <msaglt$vpj$1@ger.gmane.org>
References <c3363$547e74fe$5419aafe$24179@news.ziggo.nl> <4602a32c-5109-47dd-95bb-b9723738f07f@googlegroups.com> <CALwzid=mehH8poQA=FoEaZXRhyGcAAMP+aKw-3O8+ymz8zwNNA@mail.gmail.com> <msaglt$vpj$1@ger.gmane.org>
From Ian Kelly <ian.g.kelly@gmail.com>
Date Thu, 3 Sep 2015 16:45:37 -0600
Subject Re: Python handles globals badly.
To Python <python-list@python.org>
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 <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.102.1441320380.8327.python-list@python.org> (permalink)
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

Show key headers only | View raw


On Thu, Sep 3, 2015 at 4:13 PM, Mark Lawrence <breamoreboy@yahoo.co.uk> wrote:
> On 03/09/2015 20:47, Ian Kelly wrote:
>>
>> On Thu, Sep 3, 2015 at 1:05 PM,  <tdev@freenet.de> 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).

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Re: Python handles globals badly. tdev@freenet.de - 2015-09-03 12:05 -0700
  Re: Python handles globals badly. Ian Kelly <ian.g.kelly@gmail.com> - 2015-09-03 13:47 -0600
  Re: Python handles globals badly. Ian Kelly <ian.g.kelly@gmail.com> - 2015-09-03 13:51 -0600
  Re: Python handles globals badly. Mark Lawrence <breamoreboy@yahoo.co.uk> - 2015-09-03 23:13 +0100
  Re: Python handles globals badly. Ian Kelly <ian.g.kelly@gmail.com> - 2015-09-03 16:45 -0600
  Re: Python handles globals badly. Michael Torrie <torriem@gmail.com> - 2015-09-03 18:06 -0600
  Re: Python handles globals badly. Mark Lawrence <breamoreboy@yahoo.co.uk> - 2015-09-04 01:47 +0100
  Re: Python handles globals badly. Steven D'Aprano <steve@pearwood.info> - 2015-09-04 12:27 +1000
  Re: Python handles globals badly. Steven D'Aprano <steve@pearwood.info> - 2015-09-04 12:33 +1000
    Re: Python handles globals badly. Antoon Pardon <antoon.pardon@rece.vub.ac.be> - 2015-09-08 11:07 +0200
  Re: Python handles globals badly. Antoon Pardon <antoon.pardon@rece.vub.ac.be> - 2015-09-08 10:59 +0200
    Re: Python handles globals badly. Steven D'Aprano <steve@pearwood.info> - 2015-09-09 13:27 +1000
      Re: Python handles globals badly. Ian Kelly <ian.g.kelly@gmail.com> - 2015-09-08 23:08 -0600
      Re: Python handles globals badly. Antoon Pardon <antoon.pardon@rece.vub.ac.be> - 2015-09-09 17:04 +0200
      Re: Python handles globals badly. Mark Lawrence <breamoreboy@yahoo.co.uk> - 2015-09-09 17:46 +0100
  Re: Python handles globals badly. Mark Lawrence <breamoreboy@yahoo.co.uk> - 2015-09-08 10:22 +0100
  Re: Python handles globals badly. Antoon Pardon <antoon.pardon@rece.vub.ac.be> - 2015-09-08 11:59 +0200
  Re: Python handles globals badly. Laura Creighton <lac@openend.se> - 2015-09-08 12:07 +0200

csiph-web