4 ms·
I'm not sure what you mean about Python. In Python, if you run an async function without an await, you will simply get a coroutine object that is ready to be ex
by hetman 5y ago
I'm not sure what you mean about Python. In Python, if you run an async function without an await, you will simply get a coroutine object that is ready to be executed by... someone (it's essentially a generator under the hood).
In fact, unlike JavaScript, you can't even call await from a synchronous module context. You have to either schedule that couroutine object onto an existing async event loop, or create a new event loop and run it your self.
- akdor1154 5y agoYup, Python async functions need to be explicitly awaited / scheduled pretty much exactly the same way as JS... article might be confusing this with the fact that most of the stdlib is just plain synchronous, even for web requests etc.
- jtwaleson 5y agoMaybe they used gevent which "magically" makes things async without the keywords.