Assignments and globals
echuck3 at my-deja.com
echuck3 at my-deja.com
Thu Aug 17 21:55:11 EDT 2000
Here's a very distilled version of my problem:
settings = { 'x': {}, 'y': {} }
class K:
def foo(self):
settings = settings['x']
K().foo()
I get "Name error: settings" on this. If I change the line to:
s = settings['x']
Then everything works. It appears that in the statement 'a = b', Python
starts mucking with the namespace before b is evaluated.
Is there a good reason for this? Is it even a design point, or an
accident of implementation? I wonder if JPython has this problem.
-Chuck
Sent via Deja.com http://www.deja.com/
Before you buy.
More information about the Python-list
mailing list