I’m migrating from tornado
to asyncio
, and I can’t find the asyncio
equivalent of tornado
’s PeriodicCallback
。 (A PeriodicCallback
有两个参数:要运行的函数和调用之间的毫秒数。)
asyncio
中是否有这样的等价物?- 如果没有,什么是最干净的实现方法,而不会冒一段时间后得到
RecursionError
的风险?
原文由 2Cubed 发布,翻译遵循 CC BY-SA 4.0 许可协议
对于 3.5 以下的 Python 版本:
对于 Python 3.5 及更高版本: