[Python-ideas] Control Flow - Never Executed Loop Body
Michael Selik
mike at selik.org
Mon Mar 21 15:27:52 EDT 2016
On Mon, Mar 21, 2016 at 12:35 PM Chris Barker <chris.barker at noaa.gov> wrote:
> I've taught enough and I'm sure everyone else here has too, to know that
> the "else" in a for loop in non-intuitive to a lot of folks. And maybe a
> different keyword would have been clearer. But it is what it is, could we
> keep this discussion to the proposed addition?
>
I'm not sure the keyword being "else" is the real problem. It's certainly
correlated, but I've noticed a similar confusion for "finally" and "else"
in "try" blocks, where the keywords are quite natural. The confusion might
in fact simply be a difficulty with the concept "do this if the loop
completed without breaking" rather than a difficulty linking that concept
to the word "else".
Either way, that's a tangent, and I agree that discussion on "else" should
be (mostly) separate from a discussion on adding a new keyword.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20160321/abc697ec/attachment.html>
More information about the Python-ideas
mailing list