# dummy.py
class Dummy(object):
events = []
@classmethod
def create(cls):
cls.events.append(1)
@classmethod
def display(cls):
print(cls.events)
# test1.py
from dummy import Dummy
Dummy.create()
Dummy.display()
# test2.py
from dummy import Dummy
Dummy.create()
Dummy.display()
跑步 python test1.py输出 [1] python test2.py输出 [1]
预期 我期望事件列表获得更新的价值 所以当我运行test2.py时,我得到的输出是[1,1] 我该如何实现?