Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #108831
| Path | csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail |
|---|---|
| From | Ian Kelly <ian.g.kelly@gmail.com> |
| Newsgroups | comp.lang.python |
| Subject | Re: for / while else doesn't make sense |
| Date | Thu, 19 May 2016 11:02:26 -0600 |
| Lines | 23 |
| Message-ID | <mailman.37.1463677388.27390.python-list@python.org> (permalink) |
| References | <CAHJ7fxhOeKFbu3=Jso=wgpBnH9Opr_J_6SHLDO+KtAqVFeGHnA@mail.gmail.com> <CALwzidmMbWTfhpqtQciZ3DF7B+m==r0uQwPOrZ6pn7Q0vO9xcg@mail.gmail.com> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=UTF-8 |
| X-Trace | news.uni-berlin.de 4lGJyhlcEZKksPvQa6CX/Qcw3S+Z066/6X3/hdQUt0Pw== |
| Return-Path | <ian.g.kelly@gmail.com> |
| 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; 'executed': 0.07; 'repeated': 0.07; 'exiting': 0.09; 'logic': 0.09; 'loop.': 0.09; 'semantics': 0.09; 'subject:while': 0.09; 'utilizing': 0.09; 'received:209.85.218': 0.10; 'python': 0.10; 'exception': 0.13; 'instead.': 0.15; 'thu,': 0.15; '"finally"': 0.16; '*always*': 0.16; '2016': 0.16; 'denotes': 0.16; 'executed.': 0.16; 'false),': 0.16; 'iteration,': 0.16; 'keyword.': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'sense,': 0.16; 'subject:make': 0.16; 'wrote:': 0.16; "wouldn't": 0.16; 'all,': 0.20; 'am,': 0.23; 'header:In-Reply-To:1': 0.24; 'sense': 0.26; 'handling': 0.27; 'not.': 0.27; 'message-id:@mail.gmail.com': 0.27; 'certain': 0.31; 'another': 0.32; 'good.': 0.32; 'point': 0.33; 'view,': 0.33; 'received:google.com': 0.35; 'sometimes': 0.35; 'but': 0.36; 'should': 0.36; 'there': 0.36; 'received:209.85': 0.36; '(i.e.': 0.36; 'keyword': 0.36; 'structures': 0.36; 'to:addr:python-list': 0.36; 'subject:: ': 0.37; 'received:209': 0.38; 'test': 0.39; 'well.': 0.40; 'to:addr:python.org': 0.40; 'where': 0.40; 'ever': 0.60; 'skip:u 10': 0.61; 'here.': 0.62; 'subject: / ': 0.63; 'great': 0.63; 'construct': 0.84; 'subject:else': 0.84; 'subject:sense': 0.84; 'to:name:python': 0.84 |
| 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:to; bh=gIZYkEIrIiOG+JBM0MlR1CknHYmwi2w54M6vPj/yjGU=; b=kYKSPFffVnA2bwIqCuQDK8wj1d88O22LiAES3RNB5Ws+lamQWCnvyr/Nc4RTih10eB cSJvTPyWoF728Rw16riegwGUIoMT5RVXWALJhLLr23+SJeJIq1mnl4/wX6c0NuzyT5rC Nl3LdYwb0h1oPa2R2aq2XNMnHACPVmeeUN3+t71RC1e2VQv8ZU99tdyC+YJt5JsxrvHZ tmMRfh7SErQlLv9Hb22BJdA8syEgjlLXOPeNBp5zfFlxs3cyEFFJS3oaupPdQyZ5bCMS sVZK6FU13OXuU1aPFpUmU7MA1M3qvbxRmdyxGzlcbGaI//M7rJrUGA8kpnhqSGLn5l8V bYEA== |
| 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:to; bh=gIZYkEIrIiOG+JBM0MlR1CknHYmwi2w54M6vPj/yjGU=; b=fKsievitn61umpmjqhXEowN8heFOH8u8SpwsarilwaGjOd9jZsQpA0OeRitaevXiK0 J59WoWMbTegO9YFgjdlSlWEz0ZrTQWHImtaZwg5rxpLUES4hI2iTP8tQF73DmUeryFdl mOOxQ9FUjKCrFJuUs6U/QOBNpQMmA7yz2GvT3fa/J1RBwE+Fi/z64OPJxxuerM4R+hvQ SRRgWTThU/o3yIYTU7FmPOCd+nowZtMLlIxyk96KcqxfUpOra+ZS4TQYA9YB47Ghnozr a5IbiaTu2T239NpRAO1i3ZHyudotrACkM1wgXqk+5ejhtq3fQuT7Q+rRYFjtHgDnNnqH 1U4w== |
| X-Gm-Message-State | AOPr4FXbVBLU8D2oDk5wemrvdILE8RuikcrlKbzg80Vn83yxyIlXlDKA9aVOOJ8m0riudC12jgpY+RUOdR4G8Q== |
| X-Received | by 10.202.213.88 with SMTP id m85mr2114347oig.24.1463677385824; Thu, 19 May 2016 10:03:05 -0700 (PDT) |
| In-Reply-To | <CAHJ7fxhOeKFbu3=Jso=wgpBnH9Opr_J_6SHLDO+KtAqVFeGHnA@mail.gmail.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 <python-list.python.org> |
| List-Unsubscribe | <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list/> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| X-Mailman-Original-Message-ID | <CALwzidmMbWTfhpqtQciZ3DF7B+m==r0uQwPOrZ6pn7Q0vO9xcg@mail.gmail.com> |
| X-Mailman-Original-References | <CAHJ7fxhOeKFbu3=Jso=wgpBnH9Opr_J_6SHLDO+KtAqVFeGHnA@mail.gmail.com> |
| Xref | csiph.com comp.lang.python:108831 |
Show key headers only | View raw
On Thu, May 19, 2016 at 10:31 AM, Herkermer Sherwood <theherk@gmail.com> wrote: > Most keywords in Python make linguistic sense, but using "else" in for and > while structures is kludgy and misleading. I am under the assumption that > this was just utilizing an already existing keyword. Adding another like > "andthen" would not be good. "else" makes sense from a certain point of view, but I think that logic may not be communicated well. At the start of each loop iteration, the loop construct makes a test for whether the loop should continue or not. If that test ever fails (i.e. if the condition of the while loop is false), the else block is executed instead. So you can think of it as a repeated if-else where the else block has the additional effect of exiting the loop. > But there is already a reserved keyword that would work great here. > "finally". It is already a known keyword used in try blocks, but would work > perfectly here. Best of all, it would actually make sense. > > Unfortunately, it wouldn't follow the semantics of try/except/else/finally. "finally" in exception handling denotes a block that is *always* executed. Using it for a block that is only sometimes executed would dilute that meaning.
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: for / while else doesn't make sense Ian Kelly <ian.g.kelly@gmail.com> - 2016-05-19 11:02 -0600
csiph-web