Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #109739

Re: for / while else doesn't make sense

From Grady Martin <sunnycemetery@gmail.com>
Newsgroups comp.lang.python
Subject Re: for / while else doesn't make sense
Date 2016-06-09 08:50 -0400
Message-ID <mailman.109.1465476802.2306.python-list@python.org> (permalink)
References <CAHJ7fxhOeKFbu3=Jso=wgpBnH9Opr_J_6SHLDO+KtAqVFeGHnA@mail.gmail.com> <CALwzidmMbWTfhpqtQciZ3DF7B+m==r0uQwPOrZ6pn7Q0vO9xcg@mail.gmail.com> <20160609125032.GP1607@slim>

Show all headers | View raw


On 2016年05月19日 11時02分, Ian Kelly wrote:
>"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.

Thank you for the concise explanation.  (I enjoy new tools.)

As alluded to elsewhere, this distinction makes sense when loop breaking is involved.

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: for / while else doesn't make sense Grady Martin <sunnycemetery@gmail.com> - 2016-06-09 08:50 -0400

csiph-web