Re: New Syntax -- with an implementation

Guido.van.Rossum@cwi.nl
Thu, 02 Jun 1994 21:10:13 +0200

> I support Don's change. Its backward compatable,
Can't deny that :-)

> its elegant,
That's a matter of taste. To me it's ugly.

> it makes Python easier to use
I don't believe that and you can't prove it.

> and I suspect will widen Python's usage
Pure speculation. I say it weakens the language which will probebly
deter people.

Concluding, we have one fact (it's backward compatible) and three
matters of taste/belief. Not enough!

Personally, I'm tired of this debate. Therefore I propose the
following solution.

We standardize #end comments a la pindent, and to provide a simple
interface to call pindent on a string from Python (and even from C, if
needed). Then those who are forced to let their users enter Python
code in primitive text entry boxes can apply "pindent -r" to the text
before passing it on to Python, and tell their users to use #end
comments everywhere. (As a matter of service to the user it would be
nice to also place the pindented version back in the text entry box.
If pindent finds an error the resulting lay-out should probably point
out where the error is clearer than any error message can. Friendly
applications will provide an option to switch the pindenting off.)

If there are deficiencies in pindent, these should be fixed (e.g. the
current version doesn't handle triple-quoted strings correctly -- some
would find this a feature :-). If it is too slow, rewrite it in C.

Using pindent is also sufficient for code generating programs: simply
generate #end comments and pipe the output through pindent -r.

The big advantage of using pindent is that it doesn't incur any
overhead for those who don't need it. There are no extra syntax rules
(even if you'd never write Donald's style, you'd have to know about
it, in order to read other people's code). The parser and compiler
don't have to be any bigger (== slower). And we can finally lay this
boring thread to rest...

PS. I could give a long explanation why I don't like Don's solution,
but I have chosen not to, since it is very much a matter of taste --
others have already explained why they don't like it and I don't think
yet another explanation will add much to the discussion. I just note
that it is controversial, and I use my own judgement and intuition
(and the fact that it's MY language :-) to devise a solution.

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