[EMAIL PROTECTED] wrote: > That does make sense. So there is no way to modify a variable in an > outer lexical scope? Is the use of a mutable data type the only way? > > I'm trying to think of a case that would create semantic ambiguity when > being able to modify a variable reference in an outer scope, but I > cannot (which is probably short-sighted). Is this behavior correct > because of performance or perhaps because of a certain design of the > interpreter?
That is by design and IMO a good thing as you don't need to declare things(the '=' sort of done it for you) in python. I think you can do something like globals()['s'] but that is ugly and should be discouraged. Just use a mutable object like s=[1] or a Ref class or whatever similar implementation if you need this "shared write" functionality. Just reading is perfectly fine. -- http://mail.python.org/mailman/listinfo/python-list