Path: csiph.com!news.swapon.de!feeder.erje.net!1.eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed7.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.000 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'operator': 0.03; 'value,': 0.03; 'subject:Python': 0.05; 'assignment': 0.07; 'repeated': 0.07; 'cc:addr:python-list': 0.09; 'spelling': 0.09; 'python': 0.10; 'useful,': 0.13; 'thu,': 0.15; '"while': 0.16; 'boolean': 0.16; 'comma': 0.16; 'consciously': 0.16; 'expected,': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'operator.)': 0.16; 'value),': 0.16; 'wrote:': 0.16; "wouldn't": 0.16; '2015': 0.20; 'cc:2**0': 0.20; 'cc:addr:python.org': 0.20; 'prevent': 0.20; 'logical': 0.22; 'sep': 0.22; 'am,': 0.23; '(like': 0.23; 'ignored.': 0.23; 'thus': 0.24; 'written': 0.24; 'header:In-Reply-To:1': 0.24; 'sort': 0.25; "doesn't": 0.26; 'sense': 0.26; 'chris': 0.26; 'fri,': 0.27; 'message- id:@mail.gmail.com': 0.27; 'yield': 0.27; 'yields': 0.29; "i'm": 0.30; 'posts': 0.30; 'skip:_ 10': 0.32; 'statement': 0.32; 'useful': 0.33; 'previous': 0.34; 'received:google.com': 0.35; 'could': 0.35; 'returning': 0.35; 'something': 0.35; 'but': 0.36; '(and': 0.36; 'subject:: ': 0.37; 'two': 0.37; 'expect': 0.37; 'say': 0.37; 'doing': 0.38; 'why': 0.39; "didn't": 0.39; 'where': 0.40; 'some': 0.40; 'your': 0.60; 'places': 0.64; 'legal': 0.66; 'therefore': 0.67; 'chrisa': 0.84; 'to:none': 0.91; 'mistake': 0.91 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:cc :content-type; bh=yPlaaLD+gB7FV4fB+/vG60N32x/6oz6EGO9Ozhbndaw=; b=v2EQ4suTqGT06J0bqcR/sERTrftPp+Gm1KFAgxFWHpWCquYD2ysuy6DL3cxkjS/53K BoLEjpZ+plVPpXMG843+JFsDjWk/CGkaryZdbHH2tcPbFVCtByLiuBAtALyFxR7B6w6B 9yAbT2anMPeQRNTw6es2G4uEpD0w36g/danRhdceO3jw99w33mMnFVub7WvkxoJUSnLB +wh0JjfOwiHzDxtTHlhxqkbsoyaGGkHFyy1L34MxPT9RIBLwvkNv6hW1VsFmpbd5/5DQ IDASSuqTT8GZ4IabXz66Uk/kriNJDerV0AKWroUR9hfbbx5bbLNStYfSNp2Qem7RmWm7 AhaA== MIME-Version: 1.0 X-Received: by 10.50.98.7 with SMTP id ee7mr11462297igb.13.1441935340784; Thu, 10 Sep 2015 18:35:40 -0700 (PDT) In-Reply-To: <1441915664.3216384.380230649.5CF010BC@webmail.messagingengine.com> References: <86fa425b-d660-45ba-b0f7-3beebdec8e14@googlegroups.com> <55EE9EEC.1060907@rece.vub.ac.be> <55EEDD37.5090602@gmx.com> <55f072aa$0$1669$c3e8da3$5496439d@news.astraweb.com> <55f1a8df$0$1660$c3e8da3$5496439d@news.astraweb.com> <1441902711.3168172.380049449.32E41922@webmail.messagingengine.com> <1441915664.3216384.380230649.5CF010BC@webmail.messagingengine.com> Date: Fri, 11 Sep 2015 11:35:40 +1000 Subject: Re: Python handles globals badly. From: Chris Angelico Cc: "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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 29 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1441935344 news.xs4all.nl 23735 [2001:888:2000:d::a6]:35399 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:96312 On Fri, Sep 11, 2015 at 6:07 AM, wrote: > On Thu, Sep 10, 2015, at 12:48, Chris Angelico wrote: >> Having assignment be a statement (and therefore illegal in a loop >> condition) makes sense. Having it be an expression that yields a >> useful or predictable value makes sense. Having it be an expression, >> but not returning a value, doesn't. > > Why not? Having it not return a value (and thus be illegal in places > that expect a value), but be legal in places like C's comma operator or > Lisp's progn that do not use the value, would make logical sense. Your > while loop could be written as something like "while (ch = getchar(); > ch): ..." > > The main purpose of this would be to prevent you from using it where a > boolean is expected, which wouldn't be necessary if Python hadn't > repeated C's mistake of spelling it "=". I didn't say it doesn't make _technical_ sense to have an expression without value, but it doesn't make any _useful_ sense. In previous posts I consciously avoided this wording, but I'm going to say it, and clink my pun jar: There's no value in doing it that way. In order to make this valueless expression useful, you have to first have some sort of expression that consists of two subexpressions, where one of them is ignored. (Like C's comma operator.) Why do it? Why not simply have the expression yield a useful value - or else not be an expression, such that you have two _statements_? ChrisA