▲ | throwawayffffas 2 days ago | |
I mean everything is running on the runloop, async/await, promises, and callbacks are different flavors of syntactic sugar for the same underlying thing. In JS you can do:
In python though async and sync code runs in a fundamentally different way as far as I understand it. | ||
▲ | IshKebab 2 days ago | parent [-] | |
I'm not too familiar with Python async. The only time I used it was to get stderr and stdout out of a subprocess.run() separately. I think anyone using it for performance reasons is insane and should just switch to a more performant language. Anyway I think the main difference is that in Python you control the event loop whereas in JS there's one fixed event loop and you have no choice about it. |