3 ms·
The main takeaway for me is that in Python, this doesn't work: async def somethingLongRunning(): ... x = somethingLongRunning() ... other w
by tgsovlerkhgsel 11mo ago
The main takeaway for me is that in Python, this doesn't work:
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.
- skinner927 11mo agoI think this is a better example of what, I imagine, the author was trying to illustrate.