j
k
j a
j l
You can exec a code object and specify the environment to use for names. Jeremy
......def f(): ... print x + y ... x = 1 y = 3 f() 4 exec f.func_code in {'x':0, 'y':-3}, {} -3
...def f(): ... print x + y ... x = 1 y = 3 f() 4 exec f.func_code in {'x':0, 'y':-3}, {} -3
def f(): ... print x + y ... x = 1 y = 3 f() 4 exec f.func_code in {'x':0, 'y':-3}, {} -3
Back to the thread
Back to the list