> I think you can work around your problem by using the same dictionary for
> both locals and globals. The locals/globals distinction is not useful in
> your circumstances. For example, the Python interpreter has these the same:
>
>  >>> globals() is locals()
>  True
>

Interesting... In my case, what I actually do (in the Pydev debugger)
is that I find the frame where the code should be evaluated and then
with the selected frame I do:

frame = findframe(...)
...
eval(expression, frame.f_globals, frame.f_locals)

So, in that case, you think that instead of using frame.f_globals I should use:
updated_globals = dict()
updated_globals.update(frame.f_globals)
updated_globals.update(frame.f_locals) #locals later because it has
precedence over the actual globals

eval(expression, updated_globals, frame.f_locals)

Is that it? -- I think that eval(expression, frame.f_locals,
frame.f_locals) wouldn't work as expected in my actual case... (and I
can't force the frame.f_globals and frame.f_locals to be the same)

Thanks,

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

Reply via email to