[Python-Dev] replacing 'global'
Just van Rossum
just at letterror.com
Sun Oct 26 06:35:09 EST 2003
Skip Montanaro wrote:
> >> * Would you be required to use := at each assignment or just
> >> the first?
> Just> Just the first; "a = 2" still means "a is local to this scope".
> That seems like a very subtle error waiting to happen...
Since I said the wrong thing, I'm not sure how to respond to this... Do
you still feel the same way with my corrected reply?
> >> * This seems like a statement which mixes declaration and
> >> execution.
> Just> How is that different from "regular" assignment? It mixes
> Just> declaration and execution in the same way.
> Not in the way of saying, "this is global and here's its value".
In a way := is the opposite of "this is local and here's its value". It
says: "this is defined _somewhere_ and here's its new value".
More information about the Python-Dev