Asynchroner Methodenaufruf in Python?

Ich habe mich gefragt, ob es eine Bibliothek für asynchrone Methodenaufrufe gibtPython. Es wäre toll, wenn Sie so etwas tun könnten

@async
def longComputation():
    <code>


token = longComputation()
token.registerCallback(callback_function)
# alternative, polling
while not token.finished():
    doSomethingElse()
    if token.finished():
        result = token.result()

Oder um eine nicht asynchrone Routine asynchron aufzurufen

def longComputation()
    <code>

token = asynccall(longComputation())

Es wäre großartig, eine verfeinerte Strategie als Muttersprachler im Sprachkern zu haben. Wurde dies in Betracht gezogen?

Antworten auf die Frage(12)

Ihre Antwort auf die Frage