<p>我找到了答案-<em>你不知道。在</p>
<p><a href="http://code.activestate.com/lists/python-dev/122554/" rel="nofollow">http://code.activestate.com/lists/python-dev/122554/</a></p>
<p>引用我在上面的URL上找到的一篇文章,我想已经解释过了——简短的回答是“泛型函数”是用于无状态算法的。我不知道这个定义。在</p>
<blockquote>
<p>Correct. OO and generic functions are different development paradigms,
and there are limitations on mixing them. Generic functions are for
stateless algorithms, which expect to receive all required input
through their arguments. By contrast, class and instance methods
expect to receive some state implicitly - in many respects, they
<em>already are</em> generic functions.</p>
<p>Thus, this is really a request for dual dispatch in disguise: you want
to first dispatch on the class or instance (through method dispatch)
and <em>then</em> dispatch on the second argument (through generic function
dispatch).</p>
<p>Dual dispatch is much harder than single dispatch and
"functools.singledispatch" does not and should not support it (it's in
the name). As PJE noted, you <em>can</em> use singledispatch with
staticmethods, as that eliminates the dual dispatch behaviour by
removing the class and instance based dispatch step. You can also
register already bound class and instance methods as implementations
for a generic function, as that also resolves the dual dispatch in a
way that means the single dispatch implementation doesn't even need to
be aware it is happening.</p>
</blockquote>