diff --git a/pep-0492.txt b/pep-0492.txt index 770535bca..5014ff90b 100644 --- a/pep-0492.txt +++ b/pep-0492.txt @@ -884,6 +884,22 @@ stating that the statement is asynchronous. It is also more consistent with the existing grammar. +Why "async def" and not "def async" +----------------------------------- + +``async`` keyword is a *statement qualifier*. A good analogy to it are +"static", "public", "unsafe" keywords from other languages. "async +for" is an asynchronous "for" statement, "async with" is an +asynchronous "with" statement, "async def" is an asynchronous function. + +Having "async" after the main statement keyword might introduce some +confusion, like "for async item in iterator" can be read as "for each +asynchronous item in iterator". + +Also, "async def" better separates coroutines from regular functions +visually. + + Why not a __future__ import ---------------------------