4 ms·
please tell me that python did not adopt the javascript async hell. async should be an optional keyword on the CALLER side, not an invisible trait of the functi
by singularity2001 7y ago
please tell me that python did not adopt the javascript async hell. async should be an optional keyword on the CALLER side, not an invisible trait of the function. go figure()
- m_ke 7y agoIt didn't, async await is just syntactic sugar on top of coroutines/futures. You can define an sync function and get a coroutine back if you call it without await. It's still kind of a mess though because you have two universes that are not really compatible, forcing you to rewrite everything that touches IO. For django that probably means a rewrite of the ORM, caching and middlewares.
- hajile 7y agoJS async/await is also just syntactic sugar on top of Promises (which are basically just futures with the ability to write as well).
- jakear 7y agoIn Javascript, async is an optional parameter on the caller side. (Well, 'await' is, but I figure that's what you mean). It can be used with any function call, not just those that are marked async. Though it only make sense to use it with Promise-returning functions. Alternatively, you can also use it with a plain Promise, which makes for a nice mutex. I've also used this for imitating async constructors, which is not currently possible.