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 00:19:22 +1000 Lines: 38 Message-ID: References: <5792cd34$0$1587$c3e8da3$5496439d@news.astraweb.com> <87vazwppxx.fsf@elektro.pacujo.net> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Trace: news.uni-berlin.de 4dYgt3LTu7ePDYWo6vBbRgHMp8kAuj8ZoA5ZolQM2JSg== Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.001 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'that?': 0.05; 'defines': 0.07; 'session.': 0.07; 'subject:code': 0.07; 'cc:addr:python- list': 0.09; 'added.': 0.09; 'block.': 0.09; 'header?': 0.09; 'subject:Why': 0.09; 'subject:not': 0.11; '2016': 0.16; '23,': 0.16; '24,': 0.16; '9:13': 0.16; 'dummy': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'statement.': 0.16; 'statements,': 0.16; 'stuff,': 0.16; 'subject:allow': 0.16; 'wrote:': 0.16; "wouldn't": 0.16; 'debugging': 0.18; '>>>': 0.20; 'cc:2**0': 0.20; 'cc:addr:python.org': 0.20; 'pass': 0.22; 'am,': 0.23; 'sat,': 0.23; 'header:In-Reply-To:1': 0.24; 'example': 0.26; 'chris': 0.26; 'message-id:@mail.gmail.com': 0.27; 'function': 0.28; 'block,': 0.29; 'branches': 0.29; 'optional.': 0.29; 'weak': 0.29; 'that.': 0.30; 'creating': 0.30; 'code': 0.30; 'certainly': 0.30; 'filled': 0.30; 'possibly': 0.32; 'statement': 0.32; 'common': 0.33; 'received:google.com': 0.35; 'comment': 0.35; 'subject:?': 0.36; 'pm,': 0.36; 'subject:: ': 0.37; 'requirement': 0.37; 'no,': 0.38; 'or,': 0.38; 'takes': 0.39; 'rather': 0.39; 'where': 0.40; 'forget': 0.60; 'entire': 0.61; 'here.': 0.62; 'qualified': 0.63; 'statement,': 0.66; 'jul': 0.72; 'useful.': 0.72; 'actually,': 0.84; 'chrisa': 0.84; 'to:none': 0.91; 'urge': 0.91 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=GrS8i8yhRzNhD9Cp9Kh5eMUoQVqjd0poG0fUsFpQJKY=; b=fllykZ68k/gixWWSA1DKNfO001rwNa+4/1ZpWCFF6D2LjP9LAdC3OD0YaFYz90vxr6 h/va6nvNHiKeI+608JMKiB1E/gBPTms1rBZ7Yw6Ondwn1Ff56dxlhE19eWIhFIbsY1gR KOLIw6cBhfVwd+ea86v12B4JselHKQ/xLOmoD0Ssavu28oM55w9370WGTeBfbv5Cz5Dv Kaplp9Jb//LyjOjQB4fMtS/eEYEhAUSlZ7WvN2nyd8HOZQMUMdtl3g7usbS9QBheBi4b Zro/lty7NeGivQurwRByZlnrp3n9t7yhhR1QYz8P3co7b8DTV4MHRZszKuibC/FSyYHU da1Q== 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=GrS8i8yhRzNhD9Cp9Kh5eMUoQVqjd0poG0fUsFpQJKY=; b=lQRNsiEHbu1UtZJYoFuS5JuMF66mzYId7qZkPLnJay7ha0jznfpodk9yi0Y6IeexSJ T7HwBtzYEhk3W5r5cZ9J/FW/llfHCDm+4FoZu/MAwQ4qLAxTqEtTUIDqDnccNmlKCQg1 Nb+w6YN+CnDLfqrpD7HyZjyeEPniCvtpUprJmxKJCT//QXfh0FcTNJVWxMjNvGeG58ut Sowe3C6qlMkW8/fBo4Elqtp1l7kGcRuRKWz3akHPxwa3IhH44mzAIL4CYJ5GtEhiL0Qy dAoS004H3XPiFD7pKvP735T3KHrsqHvFfcAzzQ3dZxoD6UHw9VvpbaJsRaW8aSzuFAhs kaLg== X-Gm-Message-State: ALyK8tKvILShgp11Mv+PVFRpU3+j2gvyznkeY9hXPaK/gv2yPTelMdLdqQ2vLaIqwqNyCDFV7CAhHP5ZYaNL6A== X-Received: by 10.28.50.199 with SMTP id y190mr30149558wmy.61.1469283563148; Sat, 23 Jul 2016 07:19:23 -0700 (PDT) In-Reply-To: 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> Xref: csiph.com comp.lang.python:111792 On Sun, Jul 24, 2016 at 12:00 AM, BartC wrote: > On 23/07/2016 12:34, Chris Angelico wrote: >> >> On Sat, Jul 23, 2016 at 9:13 PM, Marko Rauhamaa wrote: >>>> >>>> One less thing to be programmed, one less thing for the user to >>>> remember. Just require pass any time you have an empty block, rather >>>> than try to remember where it is required and were it is optional. >>> >>> >>> Actually, the requirement of a dummy statement is a slight annoyance for >>> the programmer. After deleting a statement, you must see if you have to >>> put in a pass statement. And after adding a statement, you may feel the >>> urge to remove the redundant pass statement. >> >> >> How often do you actually need empty statements, adding stuff, >> removing stuff, like that? Possibly there's a code smell here. > > > All the time? No, or I wouldn't have qualified it with the very weak "possibly". > For example when creating a set of empty functions to be populated later, or > empty branches of if and so on to be filled in as so you go. Forget 'pass' - just give each function a docstring. That syntactically defines the block, and it's useful. > Or, for debugging or other reasons, when you need to comment out the > contents of a block. Then pass needs to be added. How often do you comment out an entire block and not its header? I don't remember the last time I did that. It's certainly not so common that adding 'pass' takes up a significant part of a debugging session. ChrisA