擅长:python、mysql、java
<p>更新后的问题,请参考您的代码:</p>
<blockquote>
<p>"But each time I instantiate A(), the instance calls straight to the
init defined in the decorator, without passing through the previous
layers."</p>
</blockquote>
<p>它这样做是因为当<code>Decorator()</code>函数创建的<code>wrapper()</code>类修饰符函数应用于<code>class A</code>时,它用自己动态定义的<code>wrapper.__init__()</code>替换了{<cd4>}的{<cd5>}。<em>每当<code>A</code>s被实例化时,</em>函数就是被调用的函数,它首先被写出来做一些事情,然后在最后调用原始的<code>A.__init__()</code>。在</p>