block scope?
Paul Rubin
http
Sat Apr 7 22:33:05 EDT 2007
More information about the Python-list mailing list
Sat Apr 7 22:33:05 EDT 2007
- Previous message (by thread): block scope?
- Next message (by thread): block scope?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
aleax at mac.com (Alex Martelli) writes: > >>> locals['x']=5 > Traceback (most recent call last): > File "<stdin>", line 1, in <module> > TypeError: 'builtin_function_or_method' object does not support item > assignment Whoops, yeah, meant "locals()['x'] = 5". > I think that ideally there should be a runtime error when assigning an > item of locals() with a key that's not a local variable name (possibly > excepting functions containing exec, which are kind of screwy anyway). I have no opinion of this, locals() has always seemed like a crazy part of the language to me and I never use it. I'd be happy to see it gone since it makes compiling a lot easier.
- Previous message (by thread): block scope?
- Next message (by thread): block scope?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list