擅长:python、mysql、java
<p>您已将<code>printNumInstances</code>声明为静态方法,但将其作为实例方法调用。你知道吗</p>
<p>我想你想要<code>Spam.printNumInstances()</code></p>
<p>(虽然它应该是一个classmethod,但如果我正确理解了代码,请参阅:<a href="https://stackoverflow.com/questions/136097/what-is-the-difference-between-staticmethod-and-classmethod">What is the difference between @staticmethod and @classmethod?</a>)</p>