我想知道Python中是否有用于异步方法调用的库。如果你能做像这样的事情那就太好了
@async
def longComputation():
<code>
token = longComputation()
token.registerCallback(callback_function)
# alternative, polling
while not token.finished():
doSomethingElse()
if token.finished():
result = token.result()
或异步调用非异步例程。
def longComputation()
<code>
token = asynccall(longComputation())
如果在语言核心中有一个更精致的策略作为原生策略,那就太好了。这是被考虑过的吗?
https://stackoverflow.com/questions/1239035
复制相似问题