PyDocs

Nav

Python Runtime Services

AsyncExitStack

contextlib

class · Added in 3.7 (source)
Async context manager for dynamic management of a stack of exit
callbacks.

For example:
    async with AsyncExitStack() as stack:
        connections = [await stack.enter_async_context(get_connection())
            for i in range(5)]
        # All opened connections will automatically be released at the
        # end of the async with statement, even if attempts to open a
        # connection later in the list raise an exception.
Members of AsyncExitStack

a

aclose
Immediately unwind the context stack.

e

enter_async_context
Enters the supplied async context manager.

p

push_async_callback
Registers an arbitrary coroutine function and arguments.
push_async_exit
Registers a coroutine function with the standard __aexit__ method signature.
0 Examples
No examples for contextlib/AsyncExitStack.
See Also
No see-alsos for contextlib/AsyncExitStack
0 Notes
No notes for AsyncExitStack