擅长:python、mysql、java
<p>使用源代码</p>
<pre><code>def ismethod(object):
"""Return true if the object is an instance method.
Instance method objects provide these attributes:
__doc__ documentation string
__name__ name with which this method was defined
im_class class object in which this method belongs
im_func function object containing implementation of method
im_self instance to which this method is bound, or None"""
return isinstance(object, types.MethodType)
</code></pre>
<p>第一个参数是<code>self</code>,这只是惯例。通过从类的dict按名称访问方法,您将绕过绑定,因此它看起来是一个函数而不是一个方法</p>
<p>如果要按名称访问方法,请使用</p>
^{pr2}$