[Python-Dev] Changing a value in a frame (for a debugger)

Greg Ewing greg.ewing at canterbury.ac.nz
Thu Feb 8 00:06:56 CET 2007


Fabio Zadrozny wrote:

> Would it be ok to add a feature request for that?

It seems a reasonable thing to suggest. Instead of
a copy, locals() could return a mapping object that
is a view of the underlying array. The only limitation
then would be that you couldn't add new keys.

> I initially thought it 
> was completely read-only, but I find it strange that it affects the 
> topmost frame correctly

That's because the topmost frame has a module's dict
as its locals, so in that case you are modifying them
directly. It's only code compiled as the body of a
function that uses an array for locals.

--
Greg


More information about the Python-Dev mailing list