Difference between revisions of "Await"
Jump to navigation
Jump to search
↑ https://www.python.org/downloads/release/python-350/#:~:text=is%20available%20here.-,Python%203.5.,released%20on%20September%2013th%2C%202015.
(11 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
− | [[wikipedia:Await]] | + | {{lowercase}} |
+ | [[wikipedia:await]] | ||
+ | |||
+ | * Await feature is found in C# 5.0, C++, [[Python 3.5]], F#, Hack, Julia, Dart, Kotlin 1.1, Rust 1.39, Nim 0.9.4 and [[JavaScript]] ES2017 | ||
== In Python == | == In Python == | ||
− | Python 3.5 (2015)<ref>https://www.python.org/downloads/release/python-350/#:~:text=is%20available%20here.-,Python%203.5.,released%20on%20September%2013th%2C%202015.</ref> has added support for async/await as described in PEP 492 (https://www.python.org/dev/peps/pep-0492/). | + | [[Python 3.5]] (2015)<ref>https://www.python.org/downloads/release/python-350/#:~:text=is%20available%20here.-,Python%203.5.,released%20on%20September%2013th%2C%202015.</ref> has added support for <code>[[async]]/[[await]]</code> as described in [[PEP]] 492 (https://www.python.org/dev/peps/pep-0492/). |
− | |||
− | |||
− | async def main(): | + | [[import]] [[asyncio]] |
− | + | ||
− | + | [[async]] [[def]] main(): | |
− | + | [[print]]("hello") | |
+ | await asyncio.[[sleep]](1) | ||
+ | print("world") | ||
+ | |||
+ | asyncio.run(main()) | ||
− | + | == Related == | |
− | + | [[import]] [[asyncpg]] | |
== See also == | == See also == | ||
+ | * {{import}} | ||
* {{programming}} | * {{programming}} | ||
[[Category:Programming]] | [[Category:Programming]] |
Latest revision as of 07:52, 7 June 2024
- Await feature is found in C# 5.0, C++, Python 3.5, F#, Hack, Julia, Dart, Kotlin 1.1, Rust 1.39, Nim 0.9.4 and JavaScript ES2017
In Python[edit]
Python 3.5 (2015)[1] has added support for async/await
as described in PEP 492 (https://www.python.org/dev/peps/pep-0492/).
import asyncio async def main(): print("hello") await asyncio.sleep(1) print("world") asyncio.run(main())
Related[edit]
import asyncpg
See also[edit]
- import, import (Python):
import [ os | argparse | sys | psutil | yaml | logging | websockets ]
,from
- Programming: C, Python,
go
,loop
,while
,for
,if
,variable
, Error handling, Regex, Function, IDE, await, R (programming language), XACML, Type, Class inheritance, Methods, Scheme, Array, Deserialization
Advertising: