I wonder if the following is possible:
def inject_n_call(f unc, **kwds):
'''Call func by first updating its locals with kwds.'''
def f():
return x*y
12
I've been playing with sys.settrace, updating frame.f_locals in the
trace function, but it doesn't seem to work. Any other ideas ?
George
def inject_n_call(f unc, **kwds):
'''Call func by first updating its locals with kwds.'''
def f():
return x*y
>>inject_n_call (f, x=3, y=4)
I've been playing with sys.settrace, updating frame.f_locals in the
trace function, but it doesn't seem to work. Any other ideas ?
George
Comment