Path: csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail From: Chris Angelico Newsgroups: comp.lang.python Subject: Re: Why not allow empty code blocks? Date: Sun, 24 Jul 2016 22:48:20 +1000 Lines: 35 Message-ID: References: <5792cd34$0$1587$c3e8da3$5496439d@news.astraweb.com> <87vazwppxx.fsf@elektro.pacujo.net> <20160723082947.7cae8bd1@imp> <87fur0a44p.fsf@elektro.pacujo.net> <20160723095441.29562c54@imp> <57939373$0$1586$c3e8da3$5496439d@news.astraweb.com> <5794b1d7$0$1620$c3e8da3$5496439d@news.astraweb.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Trace: news.uni-berlin.de ZqIn12ZTDbjAejceOSPW9gCtnmYMq9M314JHMHK2iJ7A== Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.003 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'cpython': 0.05; 'bits': 0.07; 'subject:code': 0.07; 'cc:addr:python-list': 0.09; '"if': 0.09; 'coding,': 0.09; 'of)': 0.09; 'script,': 0.09; 'subject:Why': 0.09; 'python': 0.10; 'subject:not': 0.11; 'syntax': 0.13; 'things.': 0.15; 'value.': 0.15; '"well,': 0.16; '(do': 0.16; '10:17': 0.16; '2016': 0.16; '24,': 0.16; 'devs': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'head,': 0.16; 'loops': 0.16; 'mismatch': 0.16; 'naive': 0.16; 'personally,': 0.16; 'pointers,': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'sharp': 0.16; 'sheer': 0.16; 'subject:allow': 0.16; 'wrote:': 0.16; 'duplicate': 0.18; 'say,': 0.18; 'language': 0.19; 'changes': 0.20; 'cc:2**0': 0.20; 'cc:addr:python.org': 0.20; 'arguments': 0.22; 'programming': 0.22; 'errors': 0.23; '(most': 0.24; 'header:In-Reply-To:1': 0.24; "doesn't": 0.26; 'message-id:@mail.gmail.com': 0.27; 'to?': 0.27; 'accidentally': 0.29; 'argue': 0.29; 'editors': 0.29; 'pay,': 0.29; 'ago': 0.29; 'code': 0.30; 'programmers': 0.30; "i'd": 0.31; 'probably': 0.31; 'core': 0.32; 'maybe': 0.33; 'common': 0.33; "d'aprano": 0.33; 'null': 0.33; 'right?': 0.33; 'steven': 0.33; 'this?': 0.34; 'received:google.com': 0.35; 'text': 0.35; 'but': 0.36; 'too': 0.36; 'should': 0.36; 'needed': 0.36; 'loaded': 0.36; 'subject:?': 0.36; 'pm,': 0.36; 'subject:: ': 0.37; 'say': 0.37; 'things': 0.38; 'doing': 0.38; 'difference': 0.38; "won't": 0.38; 'drop': 0.38; 'anything': 0.38; 'why': 0.39; 'does': 0.39; 'easily': 0.39; 'protection': 0.60; 'high': 0.60; 'your': 0.60; 'press': 0.61; "you'll": 0.61; 'advanced': 0.61; 'eye': 0.61; 'fire': 0.63; 'more': 0.63; 'safe': 0.63; 'our': 0.64; 'world': 0.64; 'price': 0.69; 'jul': 0.72; 'protect': 0.76; 'demand': 0.79; 'chrisa': 0.84; 'examples.': 0.84; 'it"': 0.84; "it'd": 0.84; "life's": 0.84; 'metal': 0.84; 'mistakes.': 0.84; 'nice,': 0.84; 'worried': 0.84; 'to:none': 0.91; 'serious': 0.97 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:cc; bh=k1rrqWnKJInx2O0WsQlzA5H93hbB8eG4frFBzu1Tt4E=; b=CwR4hUcxxc/ihCMLYdbYEuxgrtTWF3y6QTTdtkBUsbMNoQV0vnRgyedPgE5v0Qon1k thJMuRAO2Uq8G7Vg6mIbtqztefnim2QVswfwt/+Qge21Sgpnho3hz72qc0uVSNITO+vC TF79KjNXf5wHIGFP4u90x5jWHujYIIoznLqlSIqniAQaQ8S96wfSKoM3SGRZZ471DL/J bS2+NilCHavuo5J4Fl+3EKGkomZXmw7xpW3ZA4USkmVFg+l5ojbAockcHmr6WYL3IiUf Jv1R0jy+BECsWEtfdOE0Rk8CuycUW9/tEckbZXtBqhfxod5ajzrcy+6QffmHdKsfWri0 5cJQ== 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:from:date :message-id:subject:cc; bh=k1rrqWnKJInx2O0WsQlzA5H93hbB8eG4frFBzu1Tt4E=; b=egkpGlq4IPh70M/w6kR9FzEFj6+b+THCP1xiFARpUt19sBA9jsmavtCtuBOWAfH2bS W4Wdb5jzoKz0YNShgJPR3wQ/aJDltFGVYy09BR1bXgfctrkN6JXN/Q7LnNhbLKFjIsHt YwgB3cYh8MFqq/j5h+BqMJF/Cge+IfQXC4HdfYb1Ck+N4E7N8zBiaZ4fx3BHPuT6o6K7 pzs4a6NASQksM8mP93jOoW1dsRF3m7AWdJSOVMQoM/+z3JUPf5Do/EbtYCUno1GNgVyZ 7UGyP/crmIV59C5mlupi2P95G86yzj2o5g5vR2T3UJCRQUvx5mHyfuMvExREx3xShvvX thCA== X-Gm-Message-State: AEkooutMExef+Rhzd7E/kc4LcByH/p2ZtWWEtggootKQzgv3do2gBKvaTyH70PiGG42rS8NdfVgK6GHuF49JKw== X-Received: by 10.194.221.232 with SMTP id qh8mr10608022wjc.117.1469364500842; Sun, 24 Jul 2016 05:48:20 -0700 (PDT) In-Reply-To: <5794b1d7$0$1620$c3e8da3$5496439d@news.astraweb.com> X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Mailman-Original-Message-ID: X-Mailman-Original-References: <5792cd34$0$1587$c3e8da3$5496439d@news.astraweb.com> <87vazwppxx.fsf@elektro.pacujo.net> <20160723082947.7cae8bd1@imp> <87fur0a44p.fsf@elektro.pacujo.net> <20160723095441.29562c54@imp> <57939373$0$1586$c3e8da3$5496439d@news.astraweb.com> <5794b1d7$0$1620$c3e8da3$5496439d@news.astraweb.com> Xref: csiph.com comp.lang.python:111805 On Sun, Jul 24, 2016 at 10:17 PM, Steven D'Aprano wrote: > (Do other professions make arguments like this? Do carpenters, say, argue > against nail guns because "well if you accidentally hold a loaded nail gun > to your head, then press the trigger, bad things will happen"? Or is it > just programmers who make a common practice of arguing that the programming > language should protect the user from sheer carelessness?) What about "if you accidentally drop a loaded nailgun, it will fire sharp bits of metal at high velocity in all directions"? I'd say the only difference is that carpentry has been around longer, so they had all these arguments a long time ago and settled on safe ways of doing things. Why has (most of) the programming world advanced from naive text editors to programming editors with syntax highlighting, linters, and other features? Because we are more efficient when our tools protect us from mistakes. Did people argue a few decades ago about the value of syntax highlighting? Personally, I took a long while to get from "well, it'd be nice, but I won't go to any serious effort for it" to "it's my normal way of coding, and anything that DOESN'T have it is for quick tweaks only". Also, why does CPython keep an eye on things like Coverity? If the core devs are competent, they should be able to write code that never dereferences null pointers, mismatch INCREF/DECREF, or any of those other errors - right? But life's better with protection. It's a trade-off. How much effort do you want to go to? Duplicate work in daily operation is a high price to pay, which is why Python doesn't demand "indentation AND 'end' keywords", but protection does have value. Maybe the people who are most worried about this can enact a simple rule: no dedent without a blank line? That can easily be verified by a script, and it'd protect against most of the given examples. It's not too much effort (after any reasonable-sized block you'll probably have a blank anyway, so it's only the tiniest of loops that would be affected). And no language changes are needed :) ChrisA