Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

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:

   async function foo(){...}
   function bar(){foo().then(...);}
In python though async and sync code runs in a fundamentally different way as far as I understand it.




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.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: