[EMAIL PROTECTED] (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.
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to