mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
docs/asyncio: Document new ensure_future() and deprecated async()
This commit is contained in:
parent
7185461897
commit
d7e19bb566
3 changed files with 28 additions and 20 deletions
|
@ -364,7 +364,7 @@ Simple example querying HTTP headers of the URL passed on the command line::
|
|||
|
||||
url = sys.argv[1]
|
||||
loop = asyncio.get_event_loop()
|
||||
task = asyncio.async(print_http_headers(url))
|
||||
task = asyncio.ensure_future(print_http_headers(url))
|
||||
loop.run_until_complete(task)
|
||||
loop.close()
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue