3 ms·
Having worked with Asynchronous python since the days of twisted, tornado - I haven't really found any real reason to switch to asyncio. Generally speaking the
by luckycharms810 7y ago
Having worked with Asynchronous python since the days of twisted, tornado - I haven't really found any real reason to switch to asyncio. Generally speaking the old forms of async syntax (@coroutine, @inline_callback) make it incredibly clear that you are executing code well outside of a sequential paradigm - they force you to think a little more about what is going on.
The idea of Django throwing errors when you try and run async unsafe code within an event loop gives me cause for concern. I can just imagine folks who don't understand adding 'yield', 'await', 'yield from' until the errors go away - while being confused with the resulting execution. I think there is always a place for synchronous code in Python - I think Django should lean in to the simplicity afforded by it.
Last note - I also am very weary to mix asynchronous code with other primitives like threading, multiprocessing. If I am going the route of async programming - I usually just intend to optimize a single thread - and then I leave it up to the OS to optimize across multiple processes.
- j88439h84 7y ago> Having worked with Asynchronous python since the days of twisted, tornado - I haven't really found any real reason to switch to asyncio. Agree. On the other hand, Trio (https://trio.readthedocs.io/ https://trio.readthedocs.io/) gives me plenty of reasons to switch.
- fjp 7y agoI'm a really big fan of using aiohttp + aiopg + some light wrapping for CRUD APIs
- kissgyorgy 7y ago> I also am very weary to mix asynchronous code with other primitives like threading, multiprocessing. If I am going the route of async programming - I usually just intend to optimize a single thread - and then I leave it up to the OS to optimize across multiple processes. A lot of the time you simply can't not have another thread or process, for example, when you have a blocking library call or CPU intensive task.