SUITE2 

See also$_{__aiter__()}$ and$_{__anext__()}$ for details. 

(continued from previous page) 

It is a$_{SyntaxError}$to use an$_{async for}$statement outside the body of a coroutine function. 

## 8.8.3 The $_{async with}$statement 

async_with_stmt ::= "async" with_stmt 

An asynchronous context manager is a context manager that is able to suspend execution in its enter and exit methods. The following code: 

async with EXPRESSION as TARGET: SUITE 

is semantically equivalent to: 

manager=(EXPRESSION) aenter =type(manager) .__aenter__ aexit =type(manager) .__aexit__ value= await aenter(manager) hit_except = False try : TARGET =value SUITE except : hit_except = True if not await aexit(manager, *sys.exc_info()): raise finally : if not hit_except: await aexit(manager, None , None , None ) 

See also$_{__aenter__()}$ and$_{__aexit__()}$ for details. 

It is a$_{SyntaxError}$to use an$_{async with}$ statement outside the body of a coroutine function. 

See also: 

PEP 492 - Coroutines with async and await syntax The proposal that made coroutines a proper standalone con- cept in Python, and added supporting syntax. 

