Parse Method Variable Names In Python?
<p>Given the python function:</p>

<pre><code>def MyPythonMethod(value1, value2):
    # defining some variables 
    a = 4
    myValue = 15.65
    listValues = [4, 67, 83, -23]

    # doing some operation on the list
    listValues[0] = listValues[1]       

    # looping through the values
    for i in listValues:
        print i 
</code></pre>

<p>How can I extract the <code>names</code> and <code>types</code> of all the variables in method <code>MyPythonMethod</code>?</p>

<p>Ideally, I'd like to get all variable names and their types given a method name. for example, the output for method <code>MyPythonMethod</code> will look like this:</p>

<p><code>varNames = ["a", "myValue", "listValues", "i"]</code></p>

<p><code>varTypes = ["int", "float", "list", "float"]</code></p>

<p>Any ideas?</p>
