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


Groups > comp.lang.python > #96666

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 <antoon.pardon@rece.vub.ac.be>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.002
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'operator': 0.03; 'subject:Python': 0.05; 'model,': 0.05; 'received:134': 0.05; 'assignment': 0.07; 'command.': 0.09; 'effect.': 0.09; 'here?': 0.09; 'stating': 0.09; 'python': 0.10; 'language,': 0.11; 'index': 0.13; 'def': 0.13; '(but': 0.15; 'value.': 0.15; 'assignment?': 0.16; 'assignments.': 0.16; 'dislike': 0.16; 'expression)': 0.16; 'messy': 0.16; 'operator.': 0.16; 'received:ac.be': 0.16; 'verbose': 0.16; 'weird.': 0.16; 'wrote:': 0.16; 'language': 0.19; '>>>': 0.20; '2015': 0.20; 'commands,': 0.22; 'context.': 0.22; 'logical': 0.22; 'sep': 0.22; 'suppose': 0.22; 'programming': 0.22; 'consistent': 0.23; 'header:In-Reply-To:1': 0.24; 'discussion': 0.24; 'mon,': 0.24; 'header:User-Agent:1': 0.26; "doesn't": 0.26; 'point.': 0.27; 'question': 0.27; 'errors.': 0.27; 'fine': 0.28; 'calculated': 0.29; 'sure,': 0.29; 'asked': 0.29; 'received:be': 0.30; 'skip:_ 10': 0.32; 'generally': 0.32; 'language.': 0.32; 'class': 0.33; 'avoiding': 0.33; 'steven': 0.33; 'similar': 0.33; 'clear': 0.35; 'important.': 0.35; 'requiring': 0.35; 'something': 0.35; "isn't": 0.35; 'but': 0.36; 'skip:i 20': 0.36; 'actions': 0.36; 'to:addr:python-list': 0.36; 'pm,': 0.36; 'subject:: ': 0.37; 'being': 0.37; 'thought': 0.37; 'why': 0.39; 'sure': 0.39; 'to:addr:python.org': 0.40; 'some': 0.40; 'questions': 0.40; 'your': 0.60; 'side': 0.62; 'personal': 0.63; 'within': 0.64; 'between': 0.65; 'believe': 0.66; 'experience.': 0.66; 'talking': 0.67; 'afaics': 0.84; 'aspect.': 0.84; 'beats': 0.84; 'beside': 0.84; "d'aprano:": 0.84; 'fact.': 0.84; 'flaw': 0.84; 'flaw,': 0.84; 'pardon': 0.84; 'premise': 0.84; 'schreef': 0.84
X-IronPort-Anti-Spam-Filtered true
X-IronPort-Anti-Spam-Result AhkGANgs+VWGuA9G/2dsb2JhbABdhDsBxVYCgg8BAQEBAQGFLgEBAQMBI1UGCwsYAgIFFgsCAgkDAgECAUUTCAKIIgi1DpAshBsBAQgCIIEihVGEfYUUF4JSgUMFlV6NA4FNhyOONINsY4IRHIFWixkBAQE
Date Wed, 16 Sep 2015 10:51:08 +0200
From Antoon Pardon <antoon.pardon@rece.vub.ac.be>
User-Agent Mozilla/5.0 (X11; Linux i686; rv:31.0) Gecko/20100101 Icedove/31.8.0
MIME-Version 1.0
To python-list@python.org
Subject Re: Python handles globals badly.
References <c3363$547e74fe$5419aafe$24179@news.ziggo.nl> <86fa425b-d660-45ba-b0f7-3beebdec8e14@googlegroups.com> <CALwzid=sokeEcPA17yP=Npscg4VSJ6AaF_AMn13ypCr-BtVgwA@mail.gmail.com> <CAK_ErkjJ8ZYhtAoOC0p-DRpd5JQfb6aGWgU2T6uW5ZLtxjY2Mg@mail.gmail.com> <55EE9EEC.1060907@rece.vub.ac.be> <CAK_ErkgQPBxSc+zs7c2tGpGgQQ7s_SsAyJFB6qwcvJg68B9g0w@mail.gmail.com> <55EEDD37.5090602@gmx.com> <CAK_ErkjdWXG7aQ=Q23tq-ZVuyX_etdrC939WtCAPkeu2_5SZ8A@mail.gmail.com> <mailman.243.1441760967.8327.python-list@python.org> <55f072aa$0$1669$c3e8da3$5496439d@news.astraweb.com> <55F130CE.5060203@rece.vub.ac.be> <55F191CD.8040901@gmail.com> <mailman.361.1441957016.8327.python-list@python.org> <55f3a08d$0$1674$c3e8da3$5496439d@news.astraweb.com> <mailman.526.1442219653.8327.python-list@python.org> <55f8c248$0$1649$c3e8da3$5496439d@news.astraweb.com>
In-Reply-To <55f8c248$0$1649$c3e8da3$5496439d@news.astraweb.com>
Content-Type text/plain; charset=utf-8
Content-Transfer-Encoding 7bit
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.623.1442393476.8327.python-list@python.org> (permalink)
Lines 71
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1442393476 news.xs4all.nl 23848 [2001:888:2000:d::a6]:49729
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:96666

Show key headers only | View raw


Op 16-09-15 om 03:13 schreef Steven D'Aprano:
> On Mon, 14 Sep 2015 06:30 pm, Antoon Pardon wrote:
>
>> Op 12-09-15 om 05:48 schreef Steven D'Aprano:
>>> I believe I already acknowledged that assignment-as-expression was fine
>>> if it avoided the = versus == error, from the perspective of avoiding
>>> errors. But from the perspective of a clean and logical programming
>>> model, perhaps not so much. Assignment is imperative, not functional, and
>>> requiring it to return a result is somewhat unclean.
>> I thought practicallity beats purity? AFAICS python doesn't use such a
>> clean and logical programming model and it isn't given much critique over
>> it. So I don't think it is fair to critique assignment as an expression
>> because of this aspect.
> Python is a remarkably clean and consistent language.

Which is beside the point. Python may generally be a remarkable clean
and consistent language, we were not discussing the language in general
but a specific aspect. Arguing against C because it doesn't makes a
clear seperation between questions and actions (because the assignment
is an expression) while python doesn't either (but in other places) strikes
me as disingineous.
 

>> But we are not talking about all commands, we are just talking about
>> assignments. Sure an assignment has a side effect. But so has ls.pop(). So
>> something having a side-effect and a value is not unheard of even within a
>> python context.
> Sure, I already said that some commands might return a value.
>
> But assignment? Assignment is a pure command. There's nothing to return.
> Having `x = 23` return 23 is, well, weird. If we start from the premise
> that a return result is generated from a *calculation* or a *query*, we
> have to ask what is being calculated or asked?

You are stating your opinion as fact. Suppose I write the following class

class SetGet:
    def __init__(self, value):
        self.val = value

    def get(self):
        return self.val

    def set(self, value):
        self.val = value
        return value

So now I can write the following

index = SetGet(0)
while index.set(index.get() + 1) < 10:
  do_what_ever


So how would you answer your question as to what is calculated or asked
in the while condition here? The answer would be similar if we had just
allowed an assignment in the condition.

> And one other reason why I dislike it: it makes for a verbose and messy
> interactive experience. Take Ruby:

We are not talking about likes and dislikes. This discussion started
by you stating the the assignment as an expression in C was a design
flaw in the language. I can understand people preferring the assignment
not to be an operator. But when people start suggesting that assignment
as an operator is some kind of design flaw, which they use to criticise
a specific language, personal likes and dislikes are not important.

-- 
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-02 11:47 -0700
  Re: Python handles globals badly. tdev@freenet.de - 2015-09-02 12:32 -0700
  Re: Python handles globals badly. Emile van Sebille <emile@fenx.com> - 2015-09-02 12:34 -0700
  Re: Python handles globals badly. Ian Kelly <ian.g.kelly@gmail.com> - 2015-09-02 13:38 -0600
  Re: Python handles globals badly. "Sven R. Kunze" <srkunze@mail.de> - 2015-09-02 22:08 +0200
  Re: Python handles globals badly. MRAB <python@mrabarnett.plus.com> - 2015-09-02 21:22 +0100
  Re: Python handles globals badly. Mark Lawrence <breamoreboy@yahoo.co.uk> - 2015-09-02 22:19 +0100
  Re: Python handles globals badly. Mark Lawrence <breamoreboy@yahoo.co.uk> - 2015-09-03 02:16 +0100
  Re: Python handles globals badly. Steven D'Aprano <steve@pearwood.info> - 2015-09-03 11:49 +1000
  Re: Python handles globals badly. Vladimir Ignatov <kmisoft@gmail.com> - 2015-09-04 20:05 -0400
  Re: Python handles globals badly. Antoon Pardon <antoon.pardon@rece.vub.ac.be> - 2015-09-08 10:40 +0200
  Re: Python handles globals badly. Vladimir Ignatov <kmisoft@gmail.com> - 2015-09-08 07:55 -0400
  Re: Python handles globals badly. Akira Li <4kir4.1i@gmail.com> - 2015-09-08 15:35 +0300
  Re: Python handles globals badly. Mario Figueiredo <marfig@gmx.com> - 2015-09-08 14:05 +0100
  Re: Python handles globals badly. Ian Kelly <ian.g.kelly@gmail.com> - 2015-09-08 08:31 -0600
    Re: Python handles globals badly. Steven D'Aprano <steve@pearwood.info> - 2015-09-09 01:56 +1000
      Re: Python handles globals badly. Michael Torrie <torriem@gmail.com> - 2015-09-08 17:55 -0600
        Re: Python handles globals badly. Steven D'Aprano <steve@pearwood.info> - 2015-09-09 13:23 +1000
          Re: Python handles globals badly. Christian Gollwitzer <auriocus@gmx.de> - 2015-09-09 18:09 +0200
            Re: Python handles globals badly. Steven D'Aprano <steve@pearwood.info> - 2015-09-10 03:22 +1000
              Re: Python handles globals badly. Chris Angelico <rosuav@gmail.com> - 2015-09-10 03:27 +1000
              Re: Python handles globals badly. William Ray Wing <wrw@mac.com> - 2015-09-09 13:59 -0400
              Re: Python handles globals badly. Mark Lawrence <breamoreboy@yahoo.co.uk> - 2015-09-09 20:20 +0100
                Re: Python handles globals badly. Peter Pearson <pkpearson@nowhere.invalid> - 2015-09-10 20:49 +0000
              Re: Python handles globals badly. MRAB <python@mrabarnett.plus.com> - 2015-09-09 20:22 +0100
              Re: Python handles globals badly. Chris Angelico <rosuav@gmail.com> - 2015-09-10 05:27 +1000
      Re: Python handles globals badly. Antoon Pardon <antoon.pardon@rece.vub.ac.be> - 2015-09-09 12:42 +0200
      Re: Python handles globals badly. Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2015-09-09 09:33 -0400
  Re: Python handles globals badly. random832@fastmail.us - 2015-09-08 12:13 -0400
  Re: Python handles globals badly. MRAB <python@mrabarnett.plus.com> - 2015-09-08 18:41 +0100
  Re: Python handles globals badly. Mark Lawrence <breamoreboy@yahoo.co.uk> - 2015-09-08 23:41 +0100
  Re: Python handles globals badly. MRAB <python@mrabarnett.plus.com> - 2015-09-09 00:20 +0100
  Re: Python handles globals badly. Mark Lawrence <breamoreboy@yahoo.co.uk> - 2015-09-09 00:32 +0100
  Re: Python handles globals badly. Random832 <random832@fastmail.com> - 2015-09-08 20:02 -0400
    Re: Python handles globals badly. "Skybuck Flying" <skybuck2000@hotmail.com> - 2015-09-11 10:23 +0200
  Re: Python handles globals badly. Mario Figueiredo <marfig@gmx.com> - 2015-09-09 02:09 +0100
    Re: Python handles globals badly. Steven D'Aprano <steve@pearwood.info> - 2015-09-10 03:55 +1000
      Re: Python handles globals badly. Laura Creighton <lac@openend.se> - 2015-09-09 20:05 +0200
      Re: Python handles globals badly. Emile van Sebille <emile@fenx.com> - 2015-09-09 11:23 -0700
        Re: Python handles globals badly. Steven D'Aprano <steve@pearwood.info> - 2015-09-10 22:20 +1000
      Re: Python handles globals badly. "Sven R. Kunze" <srkunze@mail.de> - 2015-09-09 20:26 +0200
        Re: Python handles globals badly. Steven D'Aprano <steve@pearwood.info> - 2015-09-11 01:50 +1000
      Re: Python handles globals badly. random832@fastmail.us - 2015-09-09 14:59 -0400
        Re: Python handles globals badly. Steven D'Aprano <steve@pearwood.info> - 2015-09-11 01:59 +1000
          Re: Python handles globals badly. random832@fastmail.us - 2015-09-10 12:31 -0400
            Re: Python handles globals badly. Steven D'Aprano <steve@pearwood.info> - 2015-09-11 04:13 +1000
              Re: Python handles globals badly. Chris Angelico <rosuav@gmail.com> - 2015-09-11 04:33 +1000
              Re: Python handles globals badly. Jussi Piitulainen <harvesting@makes.email.invalid> - 2015-09-10 22:11 +0300
              Re: Python handles globals badly. random832@fastmail.us - 2015-09-10 16:30 -0400
          Re: Python handles globals badly. Chris Angelico <rosuav@gmail.com> - 2015-09-11 02:48 +1000
          Re: Python handles globals badly. alister <alister.nospam.ware@ntlworld.com> - 2015-09-10 19:56 +0000
          Re: Python handles globals badly. random832@fastmail.us - 2015-09-10 16:07 -0400
          Re: Python handles globals badly. Chris Angelico <rosuav@gmail.com> - 2015-09-11 11:35 +1000
          Re: Python handles globals badly. Antoon Pardon <antoon.pardon@rece.vub.ac.be> - 2015-09-11 12:19 +0200
            Re: Python handles globals badly. Marko Rauhamaa <marko@pacujo.net> - 2015-09-11 14:59 +0300
              Re: Python handles globals badly. Antoon Pardon <antoon.pardon@rece.vub.ac.be> - 2015-09-14 09:13 +0200
      Re: Python handles globals badly. Chris Angelico <rosuav@gmail.com> - 2015-09-10 05:00 +1000
      Re: Python handles globals badly. Laura Creighton <lac@openend.se> - 2015-09-09 21:14 +0200
      Re: Python handles globals badly. Chris Angelico <rosuav@gmail.com> - 2015-09-10 05:18 +1000
        Re: Python handles globals badly. Steven D'Aprano <steve@pearwood.info> - 2015-09-10 22:18 +1000
          Re: Python handles globals badly. jkn <jkn_gg@nicorp.f9.co.uk> - 2015-09-10 08:09 -0700
          Re: Python handles globals badly. rurpy@yahoo.com - 2015-09-10 12:04 -0700
            Re: Python handles globals badly. Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2015-09-10 20:33 -0400
            Re: Python handles globals badly. Gene Heskett <gheskett@wdtv.com> - 2015-09-10 22:19 -0400
            Re: Python handles globals badly. Mark Lawrence <breamoreboy@yahoo.co.uk> - 2015-09-12 03:35 +0100
            Re: Python handles globals badly. Mario Figueiredo <marfig@gmx.com> - 2015-09-12 05:11 +0100
            Re: Python handles globals badly. Mark Lawrence <breamoreboy@yahoo.co.uk> - 2015-09-12 05:38 +0100
            Re: Python handles globals badly. Mario Figueiredo <marfig@gmx.com> - 2015-09-12 16:52 +0100
            Re: Python handles globals badly. Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2015-09-12 12:24 -0400
            Re: Python handles globals badly. Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2015-09-12 12:29 -0400
            Re: Python handles globals badly. MRAB <python@mrabarnett.plus.com> - 2015-09-12 18:09 +0100
            Re: Python handles globals badly. Mario Figueiredo <marfig@gmx.com> - 2015-09-12 22:57 +0100
            Re: Python handles globals badly. Mark Lawrence <breamoreboy@yahoo.co.uk> - 2015-09-12 23:05 +0100
            Re: Python handles globals badly. Mark Lawrence <breamoreboy@yahoo.co.uk> - 2015-09-12 23:07 +0100
      Re: Python handles globals badly. "Sven R. Kunze" <srkunze@mail.de> - 2015-09-09 21:21 +0200
      Re: Python handles globals badly. Mark Lawrence <breamoreboy@yahoo.co.uk> - 2015-09-09 20:24 +0100
      Re: Python handles globals badly. Mario Figueiredo <marfig@gmx.com> - 2015-09-09 20:57 +0100
      Re: Python handles globals badly. Mark Lawrence <breamoreboy@yahoo.co.uk> - 2015-09-09 21:15 +0100
      Re: Python handles globals badly. Antoon Pardon <antoon.pardon@rece.vub.ac.be> - 2015-09-10 09:27 +0200
        Re: Python handles globals badly. Marko Rauhamaa <marko@pacujo.net> - 2015-09-10 10:49 +0300
      Re: Python handles globals badly. Michael Torrie <torriem@gmail.com> - 2015-09-10 08:21 -0600
      Re: Python handles globals badly. Antoon Pardon <antoon.pardon@rece.vub.ac.be> - 2015-09-11 09:28 +0200
        Re: Python handles globals badly. Steven D'Aprano <steve@pearwood.info> - 2015-09-12 13:48 +1000
          Re: Python handles globals badly. Antoon Pardon <antoon.pardon@rece.vub.ac.be> - 2015-09-14 10:30 +0200
            Re: Python handles globals badly. Steven D'Aprano <steve@pearwood.info> - 2015-09-16 11:13 +1000
              Re: Python handles globals badly. Steven D'Aprano <steve@pearwood.info> - 2015-09-16 11:20 +1000
                Re: Python handles globals badly. Chris Angelico <rosuav@gmail.com> - 2015-09-16 11:58 +1000
              Re: Python handles globals badly. Random832 <random832@fastmail.com> - 2015-09-15 21:54 -0400
              Re: Python handles globals badly. Antoon Pardon <antoon.pardon@rece.vub.ac.be> - 2015-09-16 10:51 +0200
      Re: Python handles globals badly. random832@fastmail.us - 2015-09-11 08:50 -0400
  Re: Python handles globals badly. Ben Finney <ben+python@benfinney.id.au> - 2015-09-09 11:26 +1000
  Re: Python handles globals badly. Chris Angelico <rosuav@gmail.com> - 2015-09-09 11:41 +1000
  Re: Python handles globals badly. Mario Figueiredo <marfig@gmx.com> - 2015-09-09 03:43 +0100
  Re: Python handles globals badly. Chris Angelico <rosuav@gmail.com> - 2015-09-09 13:03 +1000
  Re: Python handles globals badly. Ben Finney <ben+python@benfinney.id.au> - 2015-09-09 15:53 +1000

csiph-web