Steve,

Thanks, I knew about that but my question is why is it not working 
consistently?

Joe


"Steven Bethard" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> Joe wrote:
>> Isn't this a bug?
>>
>> Here's the test program:
>>
>> import code
>>
>> def test_func():
>>     lv = 1
>>     print '\n\nBEFORE lv: %s\n' % (lv)
>>     code.interact(local=locals())
>>     print '\n\nAFTER  lv: %s\n' % (lv)
>>     return
>
> Check the documentation for locals() [1]:
>
> "Update and return a dictionary representing the current local symbol 
> table. Warning: The contents of this dictionary should not be modified; 
> changes may not affect the values of local variables used by the 
> interpreter."
>
> So if you change things in the dictionary returned by locals() you won't 
> actually change the local variables.
>
> STeVe
>
> [1] http://docs.python.org/lib/built-in-funcs.html#l2h-45 


-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to