擅长:python、mysql、java
<blockquote>
<p>For any ABC you can tell all virtual subclasses via the attribute '_abc_registry'.</p>
</blockquote>
<p>不,你不能。你只能通过这种方式找到显式注册的虚拟子类。由<code>__subclasshook__</code>处理的任何内容都不会显示在您的支票中。你知道吗</p>
<p>要做您想做的事情,您必须遍历Python会话中定义的每个ABC并调用<code>isinstance</code>。虽然在CPython中,用<code>__subclasses__</code>方法遍历类型层次结构在技术上是可行的,但这可能是个坏主意。你知道吗</p>