This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Alternate ways of running coroutines
Type: enhancement Stage: resolved
Components: asyncio Versions: Python 3.10
process
Status: closed Resolution: rejected
Dependencies: Superseder:
Assigned To: Nosy List: asvetlov, matthewfrancis, yselivanov
Priority: normal Keywords:

Created on 2020-06-02 17:20 by matthewfrancis, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Messages (2)
msg370614 - (view) Author: Matthew Francis (matthewfrancis) Date: 2020-06-02 17:20
Currently, using await inside a coroutine will block inside the coroutine.  This behavior would usually be fine, but for some usecases a way to nonblockingly run coroutines without creating a Task could be useful, because tasks don't allow for a callback.  I'm suggesting a method on coroutines that runs them without blocking, and will run a callback when it's complete.
msg370623 - (view) Author: Yury Selivanov (yselivanov) * (Python committer) Date: 2020-06-02 19:59
> I'm suggesting a method on coroutines that runs them without blocking, and will run a callback when it's complete.

And how would that method be implemented? Presumably the event loop would execute the coroutine, but that API is already there, and it's called create_task.  We will not be adding a builtin method for this.

You can use Task.add_done_callback() to add a callback.
History
Date User Action Args
2022-04-11 14:59:31adminsetgithub: 85021
2020-06-02 19:59:50yselivanovsetstatus: open -> closed
resolution: rejected
stage: resolved
2020-06-02 19:59:40yselivanovsetmessages: + msg370623
2020-06-02 17:20:12matthewfranciscreate