Python: Passing a function name as an argument in a function
<p>I am trying to pass the name of a function into another function as an argument but I get an error:  "TypeError: 'str' object is not callable".  Here is a simplified example of the problem:</p>

<pre><code>def doIt(a, func, y, z):
    result = z
    result = func(a, y, result)
    return result

def dork1(arg1, arg2, arg3):
    thing = (arg1 + arg2) / arg3
    return thing

def dork2(arg1, arg2, arg3):
    thing = arg1 + (arg2 / arg3)
    return thing
</code></pre>

<p>When I call doIt like so:</p>

<pre><code>var = 'dork1'
ned = doIt(3, var, 4, 9)
print (ned)
</code></pre>

<p>I get:</p>

<pre><code>Traceback (most recent call last):
   File "&lt;pyshell#9&gt;", line 1, in &lt;module&gt;
     ned = doIt(3, var, 4, 9)
   File "&lt;pyshell#2&gt;", line 3, in doIt
     result = func(a, y, result)
TypeError: 'str' object is not callable
</code></pre>
