Overview:
-
An asyncio.Task object is marked done and the method done() returns True if the wrapped coroutine has exited.
-
The exit of the coroutine could be due to any of these reasons:
-
It returns False when the wrapped coroutine is in suspended or in running state.
Example:
# Example Python program that prints # Define coroutine # A coroutine that will bootstrap a Task # Task is done now # Run the coroutine main() in an asyncio event loop |
Output:
Task done:False 0 2 4 6 8 Task done:True |