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


Groups > comp.lang.python > #96107

Re: Python handles globals badly.

Date 2015-09-08 11:07 +0200
From Antoon Pardon <antoon.pardon@rece.vub.ac.be>
Subject Re: Python handles globals badly.
References <c3363$547e74fe$5419aafe$24179@news.ziggo.nl> <4602a32c-5109-47dd-95bb-b9723738f07f@googlegroups.com> <55e90311$0$1641$c3e8da3$5496439d@news.astraweb.com>
Newsgroups comp.lang.python
Message-ID <mailman.206.1441703357.8327.python-list@python.org> (permalink)

Show all headers | View raw


Op 04-09-15 om 04:33 schreef Steven D'Aprano:
> On Fri, 4 Sep 2015 05:05 am, tdev@freenet.de wrote:
>
>> Would you remove this keyword if it would be technically possible
> Absolutely not.
>
> I do not believe that it is technically possible, but even if it were, I
> would still argue that the Zen of Python applies:
>
> Explicit is better than implicit.
>
> Local variables should be the default, and you should explicitly declare any
> time you want to write to a global.
>
> Not the other way around, like Lua does. I've always thought that was silly:
> you should make the *desirable* thing easy to do, and the *dangerous* think
> (using globals) possible but not easy to do by accident.

You are trying to have your cake and eat it. If explicit is better than implicit
then declaring your variable at the scope it has to live in, is what you need
to do, that is the explicit way.

Not needing to declare local variables, is an implicit way, since it is behaviour
depending on something not being indicated.

-- 
Antoon Pardon

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