Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.mixmin.net!feeder.erje.net!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!post.news.xs4all.nl!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; 'python.': 0.02; 'syntax': 0.03; 'explicitly': 0.04; 'compiler': 0.05; 'debugging': 0.05; 'bug.': 0.07; 'indexing': 0.07; 'python': 0.09; '"default': 0.09; '"unexpected': 0.09; '22,': 0.09; 'assigning': 0.09; 'compact': 0.09; 'declarations': 0.09; 'pep': 0.09; 'satisfy': 0.09; 'scripts,': 0.09; 'yeah,': 0.09; 'itself.': 0.11; 'language': 0.14; '"some': 0.16; '"use': 0.16; 'behaviour.': 0.16; 'bugs,': 0.16; 'dislike': 0.16; 'doing,': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'modules,': 0.16; 'oct': 0.16; 'printing.': 0.16; 'roy': 0.16; 'sorts': 0.16; 'value"': 0.16; 'worst': 0.16; 'mon,': 0.16; 'wrote:': 0.17; 'integer': 0.17; 'unicode': 0.17; 'variable': 0.20; 'received:209.85.214.174': 0.21; 'regardless': 0.21; 'statement': 0.23; 'header:In-Reply- To:1': 0.25; 'am,': 0.27; 'bugs': 0.27; 'language.': 0.27; 'message-id:@mail.gmail.com': 0.27; 'catching': 0.29; 'array': 0.29; "i'm": 0.29; 'mode': 0.30; 'function': 0.30; 'code': 0.31; 'could': 0.32; 'print': 0.32; 'problem': 0.33; 'to:addr:python- list': 0.33; 'languages': 0.33; 'skip:d 20': 0.34; 'version': 0.34; 'received:google.com': 0.34; 'wrong': 0.34; 'nature': 0.35; 'problem,': 0.35; 'requiring': 0.35; 'especially': 0.35; 'continue': 0.35; 'received:209.85': 0.35; 'there': 0.35; 'really': 0.36; 'but': 0.36; 'bad': 0.37; 'does': 0.37; 'received:209': 0.37; 'subject:: ': 0.38; 'easier': 0.38; 'fact': 0.38; 'possible.': 0.38; 'there,': 0.38; 'several': 0.39; 'to:addr:python.org': 0.39; 'apply': 0.39; 'received:209.85.214': 0.39; 'where': 0.40; 'subject:-': 0.40; 'header:Received:5': 0.40; 'your': 0.60; 'most': 0.61; 'save': 0.61; 'telling': 0.61; 'chance': 0.61; 'kind': 0.61; 'time,': 0.62; 'truly': 0.62; 'obvious': 0.71; 'smith': 0.71; 'discovered': 0.83; '5.4': 0.84; 'horrible': 0.84; "it'd": 0.84; 'yet?': 0.84; 'do:': 0.91; 'hassle': 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:to :content-type; bh=w7AtxjJWHok+Jys4ldT7MUo3urbwugwj6ORmaqcpJGE=; b=OWxVBrBa1hpjClgT35SCoPu58ko146vfSKCLf7nDbGrnPNiocrkDpHlYkgQTURlxYB mNJWTJtj03XVZyndxsgvoRJZGO8fA9HuacwQxfppQ4JijkwachQCuSKyteLXHttOccD9 2ECnM8fBXAlFkX/iKcqXgJgjJ1RiUqFgXNIWTlxyQ3UMuAfa88FhWUenl7D4MP9vi5Cw oOGR8Y8id9xocSBMaX3iR4eGxxjB+VeXFT440fDx5Xjmi9OaTemvAv6AjIxY6H45XXLP DBoXnfTWlG+Cm8ENiOGgMgFiA/BqF/PZtKChMjo1+6MiGf8F90mfsvUyAG/KlqX3KA2j MlhQ== MIME-Version: 1.0 In-Reply-To: References: <5081d0c3$0$30003$c3e8da3$5496439d@news.astraweb.com> <5083ad3e$0$29978$c3e8da3$5496439d@news.astraweb.com> <5083c7da$0$29978$c3e8da3$5496439d@news.astraweb.com> <508448c6$0$29978$c3e8da3$5496439d@news.astraweb.com> Date: Mon, 22 Oct 2012 07:38:31 +1100 Subject: Re: A desperate lunge for on-topic-ness From: Chris Angelico To: python-list@python.org Content-Type: text/plain; charset=ISO-8859-1 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 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: 41 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1350851915 news.xs4all.nl 6845 [2001:888:2000:d::a6]:47637 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:31863 On Mon, Oct 22, 2012 at 7:19 AM, Roy Smith wrote: > Of course, the same can happen in Python. I could do: > > foo = "default value" > if blah == 47: > fooo = "some other value" > print foo > > No syntax error, no NameError, just the wrong thing printing. Yeah, that's the worst kind of bug. No error, just wrong behaviour. This kind of issue is one of the "balancing downsides" of the freedom of not requiring variable declarations. For small scripts, it's not a problem, and Python and PHP both save you the hassle of explicitly telling the language that you really do know what you're doing, and that's a Good Thing. For large modules, debugging creeps up in significance, and variable declarations are less of a cost. JaCMaScript in "use strict" mode and a good linter can catch a lot of these sorts of bugs, though it has its own weirdnesses (why does a 'var' statement apply to the whole function regardless of where it is?). C-derived languages with proper block scope have a good chance of catching bugs of this nature at compile time, but at the cost of demanding code that's mainly there to satisfy the compiler ("isn't it OBVIOUS that I want this to be an integer? I'm assigning an integer to it!"). > This does > not in any way detract from the fact that PHP is a horrible language. > Trust me, if you continue to use it, your dislike for it will only grow. > It is truly evil. Have you discovered "unexpected > T_PAAMAYIM_NEKUDOTAYIM" yet? The double-double-dot-in-Hebrew token name isn't actually a bad error; the only problem is the token name itself. If it said "unexpected T_SCOPE" or something, it'd be easier to debug. Several of PHP's most annoying issues are solved in version 5.4 (array indexing a function call that returns an array now works), but there's still a huge fundamental that's unsolved: Unicode support. Python FTW there, especially now that PEP 393 means strings are as compact as possible. ChrisA