2 ms·
> In new code I try to use threads, but certain things like yield which rely on async are simply too common and useful to stop using. Huh? I python you have t
by bhouston 2y ago
> In new code I try to use threads, but certain things like yield which rely on async are simply too common and useful to stop using.
Huh? I python you have to choose either threads or asynchronous/await? Why not combine both of them? I am so confused. C# allows for both to be combined quite naturally. And JavaScript as well allows for workers with async/await.
- elcomet 2y agoWhat do you mean? Async/await uses threads
- bhouston 2y agoI was trying to make sense of this sentence of the original commenter: "In new code I try to use threads, but certain things like yield which rely on async are simply too common and useful to stop using." Seems to suggest that threads and yield/async were mutually exclusive. I misunderstood. I will move on.
- te_chris 2y agoTo use async await you have to execute the code in a run loop.
- nwatson 2y ago... and you can push CPU-intensive stuff off to a thread-executor to avoid blocking the async run-loop
- trollbridge 2y agoThey aren't mutually exclusive, but are two basically independent features. The way you would code for one and the other is completely different.