擅长:python、mysql、java
<p><a href="http://docs.python.org/library/inspect.html#module-inspect">Since Python 2.1</a>您可以从<a href="http://docs.python.org/library/inspect.html">^{<cd2>}</a>模块导入<code>isfunction</code>。</p>
<pre><code>>>> from inspect import isfunction
>>> def f(): pass
>>> isfunction(f)
True
>>> isfunction(lambda x: x)
True
</code></pre>