1, param2):
       do_stuff()
       await some_coroutine()


The "async for" statement
=========================

   async_for_stmt ::= "async" for_stmt

An *asynchronous iterable* is able to call asynchronous code in its
*iter* implementation, and *asynchronous iterator* can call
asynchronous code in its *next* method.

The "async for" statement allows convenient iteration over
asynchronous iterators.

The following code:

   async for TARGET in ITER:
       BLOCK
   else:
       BLOCK2

Is semantically equivalent to:

   iter = (ITER)
   iter = type(iter).__aiter__(iter)
   running = True
   while running:
       try:
           TARGET = await type(iter).__anext__(iter)
       except StopAsyncIteration:
           running = False
       else:
           BLOCK
   else:
       BLOCK2

See also "__aiter__()" and "__anext__()" for details.

It is a "SyntaxError" to use an "async for" statement outside the body
of a coroutine function.


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 EXPR as VAR:
       BLOCK

Is semantically equivalent to:

   mgr = (EXPR)
   aexit = type(mgr).__aexit__
   aenter = type(mgr).__aenter__(mgr)

   VAR = await aenter
   try:
       BLOCK
   except:
       if not await aexit(mgr, *sys.exc_info()):
           raise
   else:
       await aexit(mgr, 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 concept in
     Python, and added supporting syntax.

-[ Footnotes ]-

[1] The exception is propagated to the invocation stack unless
    there is a "finally" clause which happens to raise another
    exception. That new exception causes the old one to be lost.

[2] A string literal appearing as the first statement in the
    function body is transformed into the function’s "__doc__"
    attribute and therefore the function’s *docstring*.

[3] A string literal appearing as the first statement in the class
    body is transformed into the namespace’s "__doc__" item and
    therefore the class’s *docstring*.
a