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: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.027 X-Spam-Evidence: '*H*': 0.95; '*S*': 0.00; 'subject:Python': 0.05; 'compiler': 0.05; 'that?': 0.05; 'assignment': 0.07; 'python': 0.10; 'properly': 0.15; 'conditional': 0.16; 'expression.': 0.16; 'from:addr:torriem': 0.16; 'from:name:michael torrie': 0.16; 'statement.': 0.16; 'still,': 0.16; 'wrote:': 0.16; 'gcc': 0.22; 'am,': 0.23; 'leave': 0.23; 'header:In-Reply-To:1': 0.24; 'header :User-Agent:1': 0.26; 'error': 0.27; 'accidentally': 0.29; 'notation': 0.29; "i'm": 0.30; 'programmers': 0.30; 'putting': 0.30; "can't": 0.32; 'common': 0.33; 'steven': 0.33; 'message- id:@gmail.com': 0.34; 'but': 0.36; 'to:addr:python-list': 0.36; 'subject:: ': 0.37; 'received:org': 0.37; 'wrong': 0.38; 'sure': 0.39; 'received:192': 0.39; 'to:addr:python.org': 0.40; 'still': 0.40; 'back': 0.62; 'charset:windows-1252': 0.62; 'fundamental': 0.66; 'statement,': 0.66; 'protect': 0.76; "d'aprano:": 0.84; 'fairness': 0.84; 'pardon': 0.84; 'schreef': 0.84; 'adopt': 0.91; 'widespread': 0.91 X-Virus-Scanned: amavisd-new at torriefamily.org Date: Thu, 10 Sep 2015 08:21:01 -0600 From: Michael Torrie User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 MIME-Version: 1.0 To: python-list@python.org Subject: Re: Python handles globals badly. 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> <55F130CE.5060203@rece.vub.ac.be> In-Reply-To: <55F130CE.5060203@rece.vub.ac.be> Content-Type: text/plain; charset=windows-1252 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 26 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1441894875 news.xs4all.nl 23812 [2001:888:2000:d::a6]:50292 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:96260 On 09/10/2015 01:27 AM, Antoon Pardon wrote: > Op 09-09-15 om 19:55 schreef Steven D'Aprano: >> In fairness to the C creators, I'm sure that nobody back in the early >> seventies imagined that malware and security vulnerabilities would be as >> widespread as they have become. But still, the fundamental decisions made >> by C are lousy. Assignment is an expression? > > What is wrong with that? Makes for a common error of putting an assignment in a conditional expression like: if (a=4) this_is_always_true(); GCC will give you a warning over that these days. But many C programmers still adopt a notation of if (4 == a) do_something(); to protect them if they accidentally leave out one =. If assignment was not an expression, then the compiler would properly error out every time you used a solitary = in the conditional of an if statement. Python strikes a good compromise. You can chain = in an assignment statement, but you can't use them in a conditional expression.