Hacker News new | ask | show | jobs
by vvpan 257 days ago
I'm relatively new to Python - how does one do concurrent IO without async/await?

My main complaint, though, about Python async is - because it is opt-in I never know if I forgot a sync IO call somewhere that will block my worker. JS makes everything async by default and there is effectively no chance of blocking.

2 comments

The same way you always did it: sync io in threads. Caveats are similar to async/await, but stack traces don’t suck.
take your pick: threads, fork, non-explicit coroutines (gevent), io multiplexing (select/poll/epoll/kqueue), virtual threads/goroutines