how to detect whether a python variable is a function?
<p>I have a variable, x, and I want to know whether it is pointing to a function or not.</p>

<p>I had hoped I could do something like:</p>

<pre><code>&gt;&gt;&gt; isinstance(x, function)
</code></pre>

<p>but that gives me:</p>

<pre><code>Traceback (most recent call last):
  File "&lt;stdin&gt;", line 1, in ?
NameError: name 'function' is not defined
</code></pre>

<p>The reason I picked that is because </p>

<pre><code>&gt;&gt;&gt; type(x)
&lt;type 'function'&gt;
</code></pre>
