by tgsovlerkhgsel · 1y ago · 0 comments
async def somethingLongRunning():
...
x = somethingLongRunning()
... other work that will take a lot of time ...
await x # with the expectation that this will be instant if the other work was long enough
That's counterintuitive coming from other languages and seems to defeat one of the key benefits of async/await (easy writing of async operations)?I've seen so many scripts where tasks that should be concurrent weren't simply because the author couldn't be arsed to deal with all the boilerplate needed for async. JavaScript-style async/await solves this.