Re: What else?

Guido.van.Rossum@cwi.nl
Wed, 26 Jan 1994 13:23:13 +0100

> My company uses a customisation language (called Magik) for its GIS
> that is *very* similar to Python in many ways. (A great example of
> parallel evolution - we've only just come across Python, but it appears
> Magik and Python were designed and implemented around the same
> time, and reading the Python documents last weekend I found myself
> amazed at how similar the designs are, given the different target
> audiences we have.) Magik uses `finally' to introduce code to be
> executed on loop exhaustion, and that feature is very rarely used. I
> can think of about two examples in ~200 Klines of code.

I can imagine one difference -- maybe Magik is privately owned and the
source guarded like a major trade secret? Or am I underestimating
your intelligence? :-) In any case, if you have pointers (on-line
preferred :-) to information about Magik, I'd be grateful.

Regarding a better keyword instead of 'else', how about 'finally'? It
has the advantage that it's already a reserved word. I'm always very
reluctant to add new words, 'lambda' was the first new one in years I
believe. I could even introduce a syntax which supports both 'else'
and 'finally' very easily, and simply change all the documentation and
examples and library code (I have to think about an automatic fixing
script since the head of the loop may be arbitrarily far away).

One potential problem with finally: in another context it means "do
this regardless of what happens", while on a loop the finally clause
won't be executed when it ls left via a break (or return or
exception).

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