[New-bugs-announce] [issue44407] A "Coroutines and Tasks" code example needs "asyncio.run(main())"

Atsushi Sakai report at bugs.python.org
Sun Jun 13 01:17:43 EDT 2021


New submission from Atsushi Sakai <asakaig at gmail.com>:

This is very small documentation improvement proposal.

In the "Coroutines and Tasks" doc, the code example after "Let’s modify the above example and run two say_after coroutines concurrently:" is missing "asyncio.run(main())" at the end of the code example:

async def main():
    task1 = asyncio.create_task(
        say_after(1, 'hello'))

    task2 = asyncio.create_task(
        say_after(2, 'world'))

    print(f"started at {time.strftime('%X')}")

    # Wait until both tasks are completed (should take
    # around 2 seconds.)
    await task1
    await task2

    print(f"finished at {time.strftime('%X')}")

----------
assignee: docs at python
components: Documentation
messages: 395728
nosy: AtsushiSakai, docs at python
priority: normal
severity: normal
status: open
title: A "Coroutines and Tasks" code example needs "asyncio.run(main())"
type: enhancement
versions: Python 3.9

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue44407>
_______________________________________


More information about the New-bugs-announce mailing list