Re: Automated indentation

Guido.van.Rossum@cwi.nl
Sun, 08 May 1994 13:54:49 +0200

> George Reynolds (george@vicorp.com) wrote:
> > Suggestion:
> > 1. Optionally allow replacement of the ':' after control
> > statements with 'do' (or another reasonable word)
> > 2. If 'do' is used insted of ':' the statement block is
> > terminated with 'end <keyword>' indented at the level of
> > the control word.
> > 3. Not indenting the delimited block would yield a syntax error.

I still don't like it, but I suppose for the benefit of people who
simply can't live with indentation, maybe we can invent an optional
keyword to be introduced at the end of an indented block, like

if foo and bar:
important_stuff()
more_important_stuff()
else:
less_important_stuff()
end if

where the 'end if' line would be optional and would have to be
indented properly and could be used by a re-indent routine.

This would be fairly simple for me to implement in the grammar. Note
that code inside an end-terminated block would still have to be
indented properly (else I think it WOULD require a major rewrite of
the scanner and/or the grammar) but I think we all can live with that.

I will leave the coding of the re-indenter to someone who actually
thinks they need it. :-)

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