Thus, I offer the following alternative:
Right now, each compound statement (def, for, etc.) is followed by a ':'.
This would be the same *if* the user wanted indentation to control blocks.
If they wanted to be explicit, then they would use '{' instead of the
colon and use the corresponding '}' to end the block. This would also
force them to use semicolons after non-compound statements.
In other words, using the brace instead of the colon would let you
use the proposed syntax changes. Using a colon would let you use the
old-style syntax.
For example:
--------
# old syntax (which still works)
for i in range(10):
print i
def fib(n):
if n<2:
return n
else:
return fib(n-1) + fib(n-2)
# new syntax
for i in range(10) { print i; }
def fib(n) { if n<2 { return n; } else { return fib(n-1) + fib(n-2); }}
# combining old and new ??
def fib(n):
if n<2 { return n; }
else:
return fib(n) + fib(n-2)
--------
Comments?
Steve
-- Steven Miale - smiale@cs.indiana.edu | Don't blame me - Indiana University, Bloomington, IN | I voted Libertarian.