[Tutor] asyncio or threading

Zachary Ware zachary.ware+pytut at gmail.com
Mon Feb 15 14:33:09 EST 2016


On Feb 15, 2016 1:12 PM, "CMG Thrissur" <cmgcomsol at gmail.com> wrote:
>
> Hello,
>
> I just wanted an opinion on the subject, asyncio and threading both seam
to do the same job, but i feel threading is better because of the multiple
ways i can control it.
>
> Just want get the groups opinion based on there experience in using
asyncio or threading in real life problems.

This is more of a python-list subject, I think you would receive more and
better answers there (at the cost of a lot more posts to the thread that
are only tangentially related to your query).

To answer with my own vague impressions (based on experience, but not
analyzed in depth): asyncio is substantially easier to work with, while
threads take a lot more thought to make sure you aren't trampling on what
another thread is doing. It's also quite easy to use threading for just
some parts that need it, like a blocking function that may take a long time
to complete, while using asyncio for everything else (see
BaseEventLoop.run_in_executor()).

--
Zach
(On a phone)


More information about the Tutor mailing list