ok, so if you know me well, this gets a little complex...
what I'm trying to do is execute a function from a script that requires 2 arguments where the names varry depending on the script.
but I'd like that function to be executed in a namespace where I can limit it's execution to not use certain functions from my interface.
so here's something I've tried to simulate what I want to do:
>>> def f(a3,a1,a2): print a1,a2,a3
>>> f.__defaults__ = (3,1,2)
>>> f()
1 2 3
>>> exec f.__code__ in {} # limit execution to namespace
Traceback (most recent call last):
File "<pyshell#5>", line 1, in <module>
exec f.__code__ in {}
TypeError: f() takes exactly 3 arguments (0 given)
how can I get this working??
I've placed a3
first to test a dictionary behavior thing with a locals test which didn't work...
the name doesn't matter though as it's not limited to those names