Can anyone think of a way to substitute a user-supplied dictionary as
the local dict for a function call?
e.g.
def f():
x = 5
d = {}
exec_function_in_dictionary( f, d ) # ???
print d["x"] # 5
#--------------
Right now, the way I'm doing this is to parse the function body out of
its source code and call exec on the body. This has problems ---
notably that it only works on functions for which source code can be
found, also that the parsing is tricky (but I can fix that).
--
http://mail.python.org/mailman/listinfo/python-list