3 ms·
As a big fan (and user) of Twisted, I'd like to see a discussion of why I might want to use asyncio instead, besides the So-You-Can-Use-Py3 reason.
by Scramblejams 12y ago
As a big fan (and user) of Twisted, I'd like to see a discussion of why I might want to use asyncio instead, besides the So-You-Can-Use-Py3 reason.
- kyllo 12y agoWell here's a great blog post on how to use the @asyncio.coroutine decorator to do asynchronous/non-blocking I/O in this style, as opposed to JS-style callbacks. I think the control flow is a lot clearer with coroutines as opposed to callbacks. I've never used Twisted though so I'm not sure how asyncio compares to that library. http://sahandsaba.com/understanding-asyncio-node-js-python-3-4.html http://sahandsaba.com/understanding-asyncio-node-js-python-3...
- phenom 12y agoI 'll add my experience with asyncio and twisted: 1) debugging is way better in asyncio, with ipdb you can step in co-routine. In twisted, you will end up somewhere in internals. 2) asyncio is end of unhanded error in deferred :) (or you need to remember to add addErrback everywhere, even after addColbecks and addBoth) 3) with trial testing is frustrating, sometimes error raised in wrong test because of global event loop (for instance you forgot to mock external call). In asyncio world loop passed explicitly and this is good for testing.