Path: csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail From: Michael Selik Newsgroups: comp.lang.python Subject: Re: for / while else doesn't make sense Date: Mon, 13 Jun 2016 23:45:48 +0000 Lines: 40 Message-ID: References: <9e7b6ded-15ad-490a-9842-b3da5d8a048d@googlegroups.com> <575d3430$0$11108$c3e8da3@news.astraweb.com> <575e167a$0$1608$c3e8da3$5496439d@news.astraweb.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Trace: news.uni-berlin.de t99GPkJTFVrzS5PaKizzawuFAOMbC1URqPyxITHMO6oA== Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.011 X-Spam-Evidence: '*H*': 0.98; '*S*': 0.00; 'ignored': 0.05; 'clause': 0.07; 'executed': 0.07; 'implies': 0.09; 'statements': 0.09; 'subject:while': 0.09; 'python': 0.10; 'assume': 0.11; 'explicitly': 0.15; 'folks': 0.15; '2016': 0.16; '``return``': 0.16; 'clause.': 0.16; 'conditional': 0.16; 'fire,': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; "someone's": 0.16; 'subject:make': 0.16; 'to:addr:pearwood.info': 0.16; "to:name:steven d'aprano": 0.16; 'wrote:': 0.16; '<': 0.18; 'say,': 0.18; '>': 0.18; 'to:2**1': 0.21; 'saying': 0.22; 'explicit': 0.22; 'trying': 0.22; 'am,': 0.23; 'bit': 0.23; 'header:In-Reply-To:1': 0.24; 'mon,': 0.24; 'message- id:@mail.gmail.com': 0.27; 'catching': 0.29; 'contrast,': 0.29; 'cpu': 0.29; 'now?': 0.29; 'unlikely': 0.29; 'code': 0.30; 'maybe': 0.33; 'run': 0.33; 'michael': 0.33; "d'aprano": 0.33; 'jump': 0.33; 'steven': 0.33; 'skip:& 20': 0.35; 'received:google.com': 0.35; 'execution': 0.35; 'quite': 0.35; 'expected': 0.35; 'sometimes': 0.35; 'too': 0.36; 'should': 0.36; 'received:209.85': 0.36; 'to:addr:python-list': 0.36; 'subject:: ': 0.37; 'skip:& 10': 0.37; '12,': 0.37; 'listing': 0.38; 'received:209': 0.38; 'skip:s 40': 0.38; 'received:209.85.220': 0.38; 'to:addr:python.org': 0.40; 'skip:u 10': 0.61; 'entire': 0.61; 'here.': 0.62; 'subject: / ': 0.63; 'voice': 0.63; 'hear': 0.64; 'statement,': 0.66; 'completing': 0.72; 'further,': 0.72; 'power': 0.72; '6:11': 0.84; 'earth.': 0.84; 'killing': 0.84; 'subject:else': 0.84; 'subject:sense': 0.84; 'tone': 0.84; '"one': 0.91; 'misleading': 0.91; 'tough': 0.95 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:references:in-reply-to:from:date:message-id:subject:to; bh=a8m7iBkxchLrDbvsPze0li91tUJNSpOzEkCbZ3beFL8=; b=PqJVygxgXXK1CNh+12+eB7A1LoVwmVQNRSXycm+fZ1YYqy1uW3kUC3hwIsrfXGLCr6 3lR5OJFKfX02fKFr2DlHwd+RPIew+aANWgcjB0JHEzcYbR6AnefjUoVvZJwNdPnhVH9+ 5ZFuXSVgoVhVTMr8pSrWVb9tybAc23WQ108pNU4PK3KkCLcrfBDzlgSvAfvJCu7pYv9P 2E284k5XjrDoJb2fmgnqwHDeyKd0/v5nVANbZOfMHXnoCHA+3lQxTdXVCaRoIA53qETQ wMIM1TMSwjVsWaZllJd9pz0/GtveVEStrdOeMMq8OCKFsqUyWiD1pAovCfCsN+LfZSu0 Bn0g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to; bh=a8m7iBkxchLrDbvsPze0li91tUJNSpOzEkCbZ3beFL8=; b=NSZp4doigWpfHLT0s55PeEyuGF6d5ybRZjwQoZTBIx4W+BMHvSNjO7OKmT1XMPj43X OxlWFeuPtdtHqSdFvH73kGYoOdc0b7WXxuNVCQbkfzStn4ky//DWbeBCMTYHaOSjV/gs OaHRBFMiAXM8UpqFheqstDwH7IbMdflTJnvwoXcbk4Op2UOUqlaJ6x2jqjnIPOgyvjO1 tRfK1dy8fJMM3+cfmyCGZH0NPlvJLCS6FoJkmyMOllazaLwm5X9wC7Vhoum1Xp1BahKO q78ClrVYej48JEpCvdCIvtfr8Kf8+AcE/BTYFcGnk8FJ/NyiA5ddEFwsqqVtQB4alAOE EtLA== X-Gm-Message-State: ALyK8tJwDWTKTlcViNB+IU8idb0fk1o+F2l9qjze2bAtdjAqUULqHbSC65XMxngiCqOq2NZ1U4Mmkes1m/fLUw== X-Received: by 10.55.145.67 with SMTP id t64mr16935513qkd.96.1465861557865; Mon, 13 Jun 2016 16:45:57 -0700 (PDT) In-Reply-To: <575e167a$0$1608$c3e8da3$5496439d@news.astraweb.com> X-Content-Filtered-By: Mailman/MimeDel 2.1.22 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: <9e7b6ded-15ad-490a-9842-b3da5d8a048d@googlegroups.com> <575d3430$0$11108$c3e8da3@news.astraweb.com> <575e167a$0$1608$c3e8da3$5496439d@news.astraweb.com> Xref: csiph.com comp.lang.python:109917 On Sun, Jun 12, 2016 at 10:16 PM Steven D'Aprano wrote: > On Mon, 13 Jun 2016 04:44 am, Michael Selik wrote: > > > On Sun, Jun 12, 2016 at 6:11 AM Steven D'Aprano < > > steve+comp.lang.python@pearwood.info> wrote: > > > >> - run the for block > >> - THEN unconditionally run the "else" block > >> > > > > Saying "unconditionally" is a bit misleading here. As you say, it's > > conditioned on completing the loop without break/return/raise. > > It's also conditional on the OS not killing the Python process, conditional > on the CPU not catching fire, conditional on the user not turning the power > of, and conditional on the sun not exploding and disintegrating the entire > earth. > > In the absence of any event which interferes with the normal execution of > code by the Python VM, and in the absence of one of a very few > explicit "JUMP" statements which explicitly jump out of the compound > for...else statement, the else clause is unconditionally executed after the > for clause. > > Happy now? > I think most folks assume that their program will not run as expected if the sun explodes. Saying that ``raise``, ``break``, and ``return`` are "one of a very few explicit JUMP statements" implies that they are obscure. Listing them in addition to the sun exploding suggests that you think they are similarly unlikely and should be ignored as too bizarre to consider. In contrast, I think raise, break, and return are quite common. Further, I think you do too, despite what you are trying to imply. Maybe I read the tone wrong. It's tough sometimes to hear someone's tone of voice in email.