Re: What else?

Guido.van.Rossum@cwi.nl
Tue, 25 Jan 1994 21:24:34 +0100

Stoffel Erasmus writes:

> This brings one to the question whether {else} is the best keyword
> to use with {for} and {while} loops. Is it not perhaps a case of false
> economy to `overload' this keyword? I suspect that {end} might be a
> better alternative here. One of the other alternatives might be
> {finally} (as in the {try} statement), but it might be a bit too long.

Well, it seemed a nice idea at the time...

I personally think that the optional else clause on loops is so rarely
used that it's better to remove it altogether, making the language
smaller and removing one possible cause for confusion -- since no
other language has this, one always has to explain exactly when it is
executed and when not.

On the other hand, it doesn't hurt much, and some code will
undoubtedly be broken and have to be rewritten in a more clumsy
manner. I might even try to patent it :-)

--Guido van Rossum, CWI, Amsterdam <Guido.van.Rossum@cwi.nl>
URL: <http://www.cwi.nl/cwi/people/Guido.van.Rossum.html>