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, 31 Jul 2016 02:34:27 +1000 Lines: 33 Message-ID: References: <5792cd34$0$1587$c3e8da3$5496439d@news.astraweb.com> <87vazwppxx.fsf@elektro.pacujo.net> <579B1ABB.1070500@rece.vub.ac.be> <579c2095$0$22142$c3e8da3$5496439d@news.astraweb.com> <579ca644$0$1589$c3e8da3$5496439d@news.astraweb.com> <579ccc68$0$1583$c3e8da3$5496439d@news.astraweb.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Trace: news.uni-berlin.de noC9lv5LgzxGhOMHXi+qNgFX6R9n0rUksg+btzmD7MnQ== 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; 'subject:code': 0.07; 'cc:addr:python-list': 0.09; 'brackets': 0.09; 'loop.': 0.09; 'optional': 0.09; 'subject:Why': 0.09; 'subject:not': 0.11; 'syntax': 0.13; '1:48': 0.16; '2016': 0.16; '[by': 0.16; 'constructs': 0.16; 'constructs.': 0.16; 'count)': 0.16; 'distinction.': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'iteration': 0.16; 'languages)': 0.16; 'looping': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'subject:allow': 0.16; 'terms:': 0.16; 'to]': 0.16; 'wrote:': 0.16; 'variable': 0.18; 'language': 0.19; 'cc:2**0': 0.20; 'cc:addr:python.org': 0.20; 'not,': 0.22; '31,': 0.22; 'am,': 0.23; 'code,': 0.23; 'header:In-Reply-To:1': 0.24; 'message- id:@mail.gmail.com': 0.27; 'defining': 0.27; '"do': 0.29; 'code': 0.30; 'related': 0.32; 'curious': 0.33; "d'aprano": 0.33; 'steven': 0.33; 'similar': 0.33; 'gives': 0.35; 'received:google.com': 0.35; 'but': 0.36; '(and': 0.36; 'subject:?': 0.36; 'subject:: ': 0.37; 'say': 0.37; 'end': 0.39; 'means': 0.39; 'why': 0.39; 'does': 0.39; 'more': 0.63; 'offer': 0.66; 'repeat': 0.67; 'jul': 0.72; 'special': 0.73; 'square': 0.76; 'chrisa': 0.84; 'difference.': 0.84; 'rexx,': 0.84; 'to:none': 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=hcH00mp6ZKny26MFhFePQ3KiYlnC7FHJx9BWjLDzWiw=; b=z9+hA82TFo7uMFOn0rYVkWtI1UFaF/G/m/HBMC0y8Md2M0DO/4mK2+uQ7U/wh9Kpkf P6NTgfBYrgCRNASjQ+K7gU+rJWYiUY+5+oV3kBjnZzg0TAYSL9rz1bEDAPNOlvLmEGR4 2dLZnfNcwQH8nHizvl0a8gre+kZ91ps9m7mlKkln+/gEFHao6aOWyyCNFXLP7nXJnzvT 7srTP84CDVpHdNZXs2WmTDJP9VI0KHIzUIXnB93xKEui6hBsWFEel1cjEcAhRkp3437S D0FUK0EOoUNUltENmE3Ujnf8todQl+GwQZjvrh3Ne4A2/HmY2B7YxgwqjUp6trYbT4bb XvuQ== 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=hcH00mp6ZKny26MFhFePQ3KiYlnC7FHJx9BWjLDzWiw=; b=axK0aaVMqhgBZ/bUsoAkcTVG9Y/aQXzAJREu6mxajUxii3Q0HztEINNcvkwTGNfT2i MTmlZAqLoGDp7/GjiGfxMecKyBG6Zj5Pa/MRLtOkytiKKxvCeFJQLf8FLIzIUmwZ97H+ T/xPp3m760/oqG56OIBxiIHj/cWi+Yz1F9VwN1VpgkSxDYh0oRnwEQtXFK2/RCJRACmG pPcVdXC7TSAHxtN0HPsBL/J44dfqY4vWOb60Defxxa3aThoHxcmr4ZuSvSmrUrPp6gy1 7TcA8hUW3A/kdZK1rngXbRmuAmI+JLmkf/SIBkeeYPcUs+jIfzk9pDFR3qF1CRvEL9Mn NQlw== X-Gm-Message-State: AEkoouuD6fmPUSQDoXOmo6pan5Zdyq83Z5m2jM49izsIjzockewJDY4OmiKPCP8KCvZbUSPnlgzITZybEtegKg== X-Received: by 10.28.221.8 with SMTP id u8mr47895794wmg.61.1469896467772; Sat, 30 Jul 2016 09:34:27 -0700 (PDT) In-Reply-To: <579ccc68$0$1583$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> <579B1ABB.1070500@rece.vub.ac.be> <579c2095$0$22142$c3e8da3$5496439d@news.astraweb.com> <579ca644$0$1589$c3e8da3$5496439d@news.astraweb.com> <579ccc68$0$1583$c3e8da3$5496439d@news.astraweb.com> Xref: csiph.com comp.lang.python:112087 On Sun, Jul 31, 2016 at 1:48 AM, Steven D'Aprano wrote: > Hypertalk (and related XTalk languages) offer a number of dedicated looping > constructs. Using square brackets [] for optional terms: > > repeat [forever] > repeat [for] number [times] > repeat until condition > repeat while condition > repeat with variable = start [to] end > repeat with variable = start [down to] end > > > That's right, a bare "repeat" on its own gives you an infinite loop. Does > *your* language have special syntax for infinite loops? If not, why not? Hmm, very similar to REXX, with one critical difference. Here's REXX's loops: do do forever do number do while condition do until condition do variable = start [to end] [by step] [for count] In REXX, "do forever" is like Hypertalk's "repeat forever", and the other constructs are similar (though the counted form is more flexible - you can say "do i=1 to 10" to set the end marker, or you can say "do i=1 for 10" to set an iteration count) - but "do" on its own means "execute this block of code exactly once", not an infinite loop. (do/end in this form is for defining blocks of code, like Pascal's begin/end or C's { }.) Curious distinction. ChrisA