1.5.2 for: else:

Chad Netzer chad at vision.arc.nasa.gov
Tue Jul 27 18:24:41 EDT 1999


William Tanksley wrote:

> Well, I'm suprised.  I had also expected the else clause to run on empty
> loop.  It seems so natural, in line with the meaning of a loop (loop on
> this; otherwise do that).

    Hmmm, it does seem that "finally" might have been a more descriptive
choice (but historians may point out that "else" appeared before "finally"
and was thus used instead).  Of course, if one breaks out of the loop, they
might reasonably expect to avoid the "finally" statement (otherwise, it
becomes redundant), and this is somewhat counter to it's "try" semantics...
Hmmm.






More information about the Python-list mailing list