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


Groups > comp.lang.python > #95978

Re: Python handles globals badly.

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 2015-09-03 16:45 -0600
Subject Re: Python handles globals badly.
Newsgroups comp.lang.python
Message-ID <mailman.102.1441320380.8327.python-list@python.org> (permalink)

Show all headers | 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