Antoine Pietri <antoine.piet...@gmail.com> added the comment:

On Sat, Oct 12, 2019 at 1:24 PM Caleb Hattingh <rep...@bugs.python.org> wrote:
> Even before task groups land, this API can be easily improved by adding
>
> asyncio.run_in_executor(func, *args, **kwargs)
>
> - Only valid inside a coro or async context (uses get_running_loop internally)
> - Analogous to how `loop.create_task` became `asyncio.create_task`
> - Drop having to specify `None` for the default executor
> - Users already know the `run_in_executor` name
> - Allow both positional and kwargs (we can partial internally before calling 
> loop.run_in_executor)

I think it should be run_thread() if it only works for thread.
run_in_executor() should take an executor= parameter, but it wouldn't
be as clear for beginners. I think there's value in having a simple,
explicit way of saying "I want to run this function in a thread"
without having to know what executors are.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue38306>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to