On Sun, Jan 3, 2021 at 6:44 PM Abdulla Al Kathiri <alkathiri.abdu...@gmail.com> wrote: > > I suppose asyncio.to_thread uses concurrent.futures.ThreadPoolExecutor under > the hood, so it saves us from getting the running event loop and calling the > loop.run_in_executor function . Why don’t we have a similar function for the > ProcessPoolExecutor, e.g. asyncio.to_process? >
asyncio.to_thread doesn't use ThreadPoolExecutor. Since thread is cheap, the function create a new thread every time. On the other hand, process is not cheap. That's why the only thread has convenient way to run function in. Regards, -- Inada Naoki <songofaca...@gmail.com> _______________________________________________ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@python.org https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://mail.python.org/archives/list/python-ideas@python.org/message/YPGAST223BKCD7GFIEYYOZ75ZXVYZNQX/ Code of Conduct: http://python.org/psf/codeofconduct/