On Jun 21, 8:51 pm, George Sakkis <[EMAIL PROTECTED]> wrote: > 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: > > >>> get_init_locals(f, 3) > > {'a': (), 'k': {}, 'x': 3, 'y': 1}
You might be intersted in the 'inspect' module. -- http://mail.python.org/mailman/listinfo/python-list