Path: csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail From: "D'Arcy J.M. Cain" Newsgroups: comp.lang.python Subject: Re: Why not allow empty code blocks? Date: Sat, 23 Jul 2016 09:54:41 -0400 Organization: Vex.Net Lines: 33 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> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Trace: news.uni-berlin.de jRs1esYyHK4tJkJBNUDZsgkE8031SKdVqil9StLN4xiw== 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; 'subject:code': 0.07; 'cc:addr:python-list': 0.09; 'forcing': 0.09; 'subject:Why': 0.09; 'python': 0.10; 'itself.': 0.11; 'subject:not': 0.11; 'syntax': 0.13; 'interpreter': 0.15; '+0300': 0.16; '2016': 0.16; 'door.': 0.16; "isn't.": 0.16; 'means.': 0.16; 'mistake.': 0.16; 'perl.': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'said.': 0.16; 'sequence:': 0.16; 'subject:allow': 0.16; 'wrote:': 0.16; 'programmer': 0.18; 'language': 0.19; 'cc:2**0': 0.20; 'cc:addr:python.org': 0.20; 'handles': 0.20; 'pass': 0.22; 'cc:no real name:2**0': 0.22; 'sat,': 0.23; 'header:In-Reply-To:1': 0.24; 'comments': 0.30; 'code': 0.30; 'says': 0.32; 'statement': 0.32; 'definition': 0.34; 'add': 0.34; 'but': 0.36; 'there': 0.36; 'faster': 0.36; 'subject:?': 0.36; 'subject:: ': 0.37; 'requirement': 0.37; 'charset:us-ascii': 0.37; 'speak': 0.38; 'means': 0.39; 'where': 0.40; 'still': 0.40; 'some': 0.40; 'real': 0.62; 'more': 0.63; 'safety': 0.66; 'jul': 0.72; 'obvious': 0.76; 'protect': 0.76; 'metaphor': 0.84; 'received:98.158': 0.84; 'this...': 0.84; 'net.': 0.91 In-Reply-To: <87fur0a44p.fsf@elektro.pacujo.net> X-Mailer: Claws Mail 3.9.3 (GTK+ 2.24.23; x86_64-pc-linux-gnu) 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: <20160723095441.29562c54@imp> 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> Xref: csiph.com comp.lang.python:111788 On Sat, 23 Jul 2016 16:13:58 +0300 Marko Rauhamaa wrote: > "D'Arcy J.M. Cain" : > > It's ambiguous to the reader what was actually meant. Forcing a > > "pass" there shows the reader that the empty block was not a > > mistake. > > Just let the syntax speak for itself. The code means what the language > definition says it means. Exactly so given this... for x in sequence: print("Something") If the language allowed that then we know exactly what the programmer said. What we don't know is what the programmer meant. The above is a simple and obvious statement but real code is more complicated. Add a few comments and a little nesting and what used to be obvious isn't. The interpreter would still know what the programmer said but without the pass requirement it is easier for it to be not what he meant. Python has some nice features like this one that protect the programmer and allow much faster development because there is a safety net. If you like knives without handles you know where to find Perl. Gotta go. The metaphor police are at the door. -- D'Arcy J.M. Cain System Administrator, Vex.Net http://www.Vex.Net/ IM:darcy@Vex.Net VoIP: sip:darcy@Vex.Net