Path: csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail From: Chris Angelico Newsgroups: comp.lang.python Subject: Re: The Cost of Dynamism (was Re: Pyhon 2.x or 3.x, which is faster?) Date: Wed, 23 Mar 2016 01:02:28 +1100 Lines: 33 Message-ID: References: <56e44258$0$1598$c3e8da3$5496439d@news.astraweb.com> <8737rvxs89.fsf@elektro.pacujo.net> <56e7483d$0$1608$c3e8da3$5496439d@news.astraweb.com> <56f09973$0$1601$c3e8da3$5496439d@news.astraweb.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Trace: news.uni-berlin.de dmKY4/wvmATZndeObqTQtQzDKMFCaK1r+8UGMJIm3SBQ== Return-Path: 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; 'python,': 0.02; 'happen,': 0.07; 'cc:addr:python-list': 0.09; '*is*': 0.09; 'advice.': 0.09; 'handling,': 0.09; 'ignoring': 0.09; 'php,': 0.09; 'subject:which': 0.09; 'python': 0.10; 'python.': 0.11; 'language,': 0.11; 'wed,': 0.15; '2016': 0.16; '23,': 0.16; 'distinct': 0.16; 'elsewhere.': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'handling.': 0.16; 'macro': 0.16; 'omitted,': 0.16; 'parentheses': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'subject:?)': 0.16; 'wrote:': 0.16; 'shipped': 0.18; 'language': 0.19; 'cc:2**0': 0.20; 'cc:addr:python.org': 0.20; '(the': 0.22; 'exceptions': 0.22; 'am,': 0.23; 'leave': 0.23; 'written': 0.24; 'header:In-Reply- To:1': 0.24; 'chris': 0.26; 'error': 0.27; '(e.g.': 0.27; 'message-id:@mail.gmail.com': 0.27; 'function': 0.28; 'lot.': 0.29; 'sentence': 0.29; "i'm": 0.30; 'code': 0.30; 'usually': 0.33; 'smart': 0.33; 'languages': 0.34; 'advice': 0.35; 'received:google.com': 0.35; 'false': 0.35; 'problem.': 0.35; 'step': 0.36; 'but': 0.36; 'there': 0.36; 'possible.': 0.36; 'received:209.85': 0.36; 'subject:: ': 0.37; 'two': 0.37; 'say': 0.37; 'difference': 0.38; 'received:209': 0.38; 'someone': 0.38; 'means': 0.39; 'whatever': 0.39; 'does': 0.39; 'subject:The': 0.61; 'programs': 0.62; 'due': 0.65; 'mar': 0.65; 'afraid': 0.67; '100%': 0.72; 'lack': 0.76; 'counts': 0.81; 'chrisa': 0.84; 'clearer': 0.84; 'confusion.': 0.84; 'distinguish': 0.84; 'lost,': 0.84; 'terrible': 0.84; 'absolutely': 0.88; '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; bh=4CIkNAjnwhCdklbqjn54hSpSDFedQruFPsJgkJxFGbs=; b=x90szLP3QOtGvzKkRGP0sA6l1gS/qGVX0QcOYoI1XLu9fSmLToQrty/osk768wyV0L k4e8t8Yn1PVbKuGYBLz5uqn9AxMsec3h286db5UGlW4YLdhBk1iIigVGYNG6mcoCpzbP TcLTEmxibelEqYdSZExnh7uPwzZPhZQPuYKBaiV3qqNBCUKrfooRljMTwlHBbLlArybQ YD0/vf1YZ7a1c6WAMW2AsFOx+0VFi36VryKu9jDDLBUCz0BAGpcy/kFEcGPeVPnjGF7s IjoMdYz6tSOj3c8H4T6Q7i/iLAtSMgUbUA/1T0j/2hZd3wVHbkaXrVNhR8QOGDgeyeZw SaWw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:cc; bh=4CIkNAjnwhCdklbqjn54hSpSDFedQruFPsJgkJxFGbs=; b=abHQ/EiEtfJDuRhdNfQnhuL15fwQXRJu+9TkcOs4Dw+9d2W1j3iOHRChW3+FD/h6gH CWOSrOUewHcNiZG2hA1PoaGImUO1Y0Z9u2hFO+GNqqXwNDpFcUgNL7Nzv0J+/JHXaCZE hkBMNGZbPnpLnFXefQ8kesoD1sRRKJw3SbtCCxiKPAuoCfWRJNFytkYrDHqqRhaJixxt E0NxaS60ij6Oua5ZuUi3BsR7bLhu53APxPBF8VIXOZ0Hxf9+hIEKBWrIK7dJDdIvY690 NIXdcW0QQsJRIorl4pz/b2DHtjokyaLY0c6h9r3q3ivKif8+AjBaB1Rl2xiTZmVhkEmr Dc6Q== X-Gm-Message-State: AD7BkJJANjMqCMLzeWO0jnkBpwCQvZOPtyZB4A354aqWWJhGu0q9CFof36Gc9ljboNLsgNgHdxWb8GTWNSGA8Q== X-Received: by 10.25.91.76 with SMTP id p73mr357768lfb.67.1458655348341; Tue, 22 Mar 2016 07:02:28 -0700 (PDT) In-Reply-To: X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Xref: csiph.com comp.lang.python:105489 On Wed, Mar 23, 2016 at 12:46 AM, Jon Ribbens wrote: > On 2016-03-22, Chris Angelico wrote: >> The first step in any program is to write it in the very simplest way >> possible. That usually means ignoring all error handling. And yes, >> this is true in EVERY language - C, PHP, Pike, DeScribe Macro >> Language, you name it. > > I'm afraid I have to say I think this is absolutely terrible advice. > If you write code in a language that does not have exceptions (e.g. C) > and get it working with no error handling, the chances are > approximately 100% that it will stay that way and be shipped without > error handling, until that lack causes someone a major problem. There are languages in which it's inadvisable. But can you honestly say that you've never written a C program with even a single error check omitted, first time? (The trivial case of having never written a C program counts only because smart people leave C to other people.) And PHP's strpos function is not an abomination because it's impossible to distinguish FALSE from 0, but because *most* PHP programs are written without the mandatory check for FALSE after every strpos. So yes, it does happen, a lot. The difference with languages like Python is that this actually *is* good advice in Python. Due to a mistake in editing, the parentheses around the "true in EVERY language" sentence were lost, which would have made it clearer that this is in two distinct parts: 1) This IS what happens, whatever language you use 2) This is the right thing to do in Python, but not always elsewhere. My apologies for the confusion. ChrisA