RE: Eliminating assignments and variable syntax (accessors)
Bijan Parsia <bparsia <at> email.unc.edu>
1999-08-12 12:48:37 GMT
At 10:55 PM -0400 8/11/99, Lex Spoon wrote:
>Well, it's certainly open to discussion :) I'd think it best to count the
>first indent as just part of method definition. So to get a block inside a
>method, you'd have to add *another* indentation, like this:
>
> myMethod
> | x y z |
> x := 1
> y := 2
> z := 3
Blargh! That's gross! Imagine the errors! You can't *tell*, without a
comment, whether this is a misindentation or a block. *Silent*, *SEMANTIC*
errors due to copy and paste are evil. Python doesn't have *that* problem.
I *think* that *mere* indentation doesn't generate a new block in python.
Indendation replaces the role of braces in C or begin...end in Pascal--you
have *keywords* indicating *what sort* of block you're dealing with
(neither has closures, even ersatz ones, so this problem doesn't crop up).
And, IIRC, you have a *colon* marking the start, e.g.,:
def foo(bar):
if bar == 3:
return bar
else:
return bar * 10
So, really, the opening delimiter of a block is something like *colon*
newline, rather than just new line. (I get bit by this all the time!)
(Continue reading)