G
George Sakkis
I wonder if there is a (preferably not too-hackish) solution to the
following introspection problem: given a callable and a number of
positional and/or keyword arguments, infer what would be the frame's
locals() right after the function is called. For example, given:
def f(x, y=1, *a, **k):
z = x + y
w = len(a) - len (k)
return z * w
I'd like to have a function
def get_init_locals(callable, *args, **kwds):
# TODO
pass
so that:
{'a': (), 'k': {'q': -1}, 'x': 3, 'y': 1}
Any takers ?
George
following introspection problem: given a callable and a number of
positional and/or keyword arguments, infer what would be the frame's
locals() right after the function is called. For example, given:
def f(x, y=1, *a, **k):
z = x + y
w = len(a) - len (k)
return z * w
I'd like to have a function
def get_init_locals(callable, *args, **kwds):
# TODO
pass
so that:
{'a': (), 'k': {'q': -1}, 'x': 3, 'y': 1}
Any takers ?
George