[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Accumulator
> Date: Thu, 30 May 2002 12:05:06 -0400
> From: jeremy@alum.mit.edu (Jeremy Hylton)
>
[snip]
>
> It's not at all clear to me that Python's current semantics are better
> than a variant that allowed rebinding of names in enclosing scopes.
> The PEP [a PEP is roughly equivalent to a SRFI] describing nested
> scopes says:
>
> There are technical issues that make it difficult to support
> rebinding of names in enclosing scopes, but the primary reason
> that it is not allowed in the current proposal is that Guido is
> opposed to it. His motivation: it is difficult to support,
> because it would require a new mechanism that would allow the
> programmer to specify that an assignment in a block is supposed to
> rebind the name in an enclosing block; presumably a keyword or
> special syntax (x := 3) would make this possible. Given that this
> would encourage the use of local variables to hold state that is
> better stored in a class instance, it's not worth adding new
> syntax to make this possible (in Guido's opinion).
>
To me, this is an indication that scheme got it right by separating
"define" from "set!". That way there is no possible ambiguity. Grafting
that onto python is probably more than most python programmers would
tolerate, though :-(
Mike