Re: [RFC] Draft Proposal for New Python Syntax

Guido.van.Rossum@cwi.nl
Fri, 27 May 1994 09:46:15 +0200

> If you feel it's important to use block delimiters, go ahead and type them
> in, then use a sed(1) to rip 'em out before you feed the results to Python.
> If you want them to actually override indentation, so you can have
> mis-indented code, then write a preprocessor. While indent(1) is quite
> C-specific, it might still be a good starting point.

Better yet, use the convention implemented in my "pindent.py" program
that I posted a week ago. It uses block closers like this:

def foobar(a, b):
if a == b:
a = a+1
elif a < b:
b = b-1
if b > a: a = a-1
# end if
else:
print 'oops!'
# end if
# end def foobar

When called as "pindend -c", it takes a valid Python program as input
and outputs a version augmented with block-closing comments. When
called as "pindent -r" it assumes its input is a Python program with
block-closing comments but with its indentation messed up, and outputs
a properly indented version.

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