for / while else doesn't make sense

Grady Martin sunnycemetery at gmail.com
Thu Jun 9 08:50:32 EDT 2016


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.


More information about the Python-list mailing list