←back to thread

320 points willm | 2 comments | | HN request time: 0.416s | source
Show context
throwawayffffas ◴[] No.45109435[source]
The function coloring is a non starter for me.

I would just rather write JS where everything is async by default.

replies(1): >>45109493 #
IshKebab ◴[] No.45109493[source]
Everything is not async by default in JS.
replies(2): >>45109573 #>>45110137 #
1. throwawayffffas ◴[] No.45109573[source]
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.
replies(1): >>45109696 #
2. IshKebab ◴[] No.45109696[source]
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.