3 ms·
If this await asyncio.sleep(0) doesn't yield control back to an event loop, then what the heck is it actually for?
by adammarples 11mo ago
If this
await asyncio.sleep(0)
doesn't yield control back to an event loop, then what the heck is it actually for?
- drhagen 11mo agoIt does yield control. As far as I know, that's "how you're supposed to it". But the example is not great because there is no other task available to switch to, so the event loop goes right back to where it left off. While the text says otherwise, I'm pretty sure the same thing would happen in JS, C#, and Java.
- adammarples 11mo agoRight I understand now, thanks
- jaimehrubiks 11mo agoThe article is good but the examples are not the best