我有这样的代码。
....
class SocketWatcher(Thread):
....
def run(self):
....
TicketCounter.increment() # I try to get this function
...
....
class TicketCounter(Thread):
....
def increment(self):
...
当我运行程序时,我得到了这个错误。
TypeError: unbound method increment() must be called with TicketCounter instance as first argument (got nothing instead)
我有什么方法可以从 TicketCounter 类调用 increment() 函数到 SocketWatcher 类?还是我的电话错了...