How to get a functions arguments and values from outside the function?
<p>I have searched a little bit to try to figure this one out but didn't get a solution that I was exactly looking for.</p>

<p>This is my use case:</p>

<ul>
<li>I would like to evaluate expressions from a functions/methods doc-string against the f/m's parameters and values, but from outside the function (when being called but outside execution of the function</li>
<li>I can't statically change the source code I am evaluating (cant write in new functionality) but dynamically changing (i.e. wrapping the function or adding attributes at run-time) is acceptable</li>
<li>I would prefer to stick with tools in the standard library but am willing to try external libraries if it will make the task a breeze</li>
</ul>

<p>Here is a simple example of what I am trying to do:</p>

<pre><code>def f1(a,b):
    """a==b"""
    pass

def f2(f):
    f_locals = "get f's args and values before f is executed"
    return eval(f.__doc__,None,f_locals)

&gt;&gt;&gt; f2(f1(2,2))
</code></pre>
