[Python-Dev] Explicit Lexical Scoping (pre-PEP?)
Terry Reedy
tjreedy at udel.edu
Tue Jul 11 23:23:51 CEST 2006
"Boris Borcic" <bborcic at gmail.com> wrote in message
news:e90j6o$fij$1 at sea.gmane.org...
> I agree with you (and argued it in "scopes vs augmented assignment vs
> sets"
> recently) that mutating would be sufficient /if/ the compiler would view
> augmented assignment as mutations operators :
Mutation is an operation on objects. Binding is an operation on
namespaces. The difference between objects and namespaces (and the actions
thereupon) is fundamental to Python. Asking the interpreter to view one
thing as something else which it isn't can only lead to more confusion. In
particular, asking that arithmetic operations on immutable numbers be seen
as mutations seems wacky to me.
> which it doesn't as far as concerns scopes where a variable
> appears as target only of /augmented/ assignments.
The interpreter/compiler, as far as I can think, never views binding as
mutation, nor should it. The request that it do so makes me wonder whether
it might have been a mistake to allow mutable objects in an augmented
assignment to choose to implement the associated operation as an in-place
mutation.
Terry Jan Reedy
More information about the Python-Dev
mailing list