async
/await
(syntax and keywords) in python 3.5 is very similar to async
/await
in C#.
C# example:
async void asyncTask(){
await asyncMethod()
}
Python example:
async def asyncTask():
await async_method()
Question: is the async/await in python 3.5 inspired by async/await in C#? If yes, why?
In PEP 492 (the proposal to add the await
and async
keywords) it was mentioned that C# uses them (besides others):
Why "async" and "await" keywords
async/await is not a new concept in programming languages:
- C# has it since long time ago [5];
- proposal to add async/await in ECMAScript 7 [2]; see also Traceur project [9];
- Facebook's Hack/HHVM [6];
- Google's Dart language [7];
- Scala [8];
- proposal to add async/await to C++ [10];
- and many other less popular languages.
This is a huge benefit, as some users already have experience with async/await, and because it makes working with many languages in one project easier (Python with ECMAScript 7 for instance).
(Emphasis mine)
So the keyword names were indeed inspired by C# (and other languages) and as for "why" that's also explained in the last paragraph.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With