Re:Why do we need Flask, Celery, and Redis? (2019)
by throwaway894345 on Saturday April 18, 2020 @05:12PM
(#22911136)
With asyncio, your whole app falls over if you accidentally call a library function that makes a sync API call under the covers. gevent (as I understand it; haven't actually used it) will patch all sync APIs and make them async. Also, if you do `aiohttp.get("www.example.com/foo.json").json()", you get a TypeError because coroutine has no method '.json()' (you forgot `await`) unless you're using Mypy.
[ Parent
| on HN ]
Re:Why do we need Flask, Celery, and Redis? (2019)
by meowface on Monday April 20, 2020 @01:02AM
(#22921254)
Yep, that about sums it up. gevent can't monkeypatch synchronous code that's implemented in non-Python native modules, but I think pretty much all native Python libraries struggle with those sorts of things, and asyncio of course also can't deal with it.
The vast majority of the time, gevent's monkeypatching works without any issues. With asyncio, you basically have to rewrite everything from the ground up to always use the new async APIs, and you can't interact with libraries that do sync I/O.