euporie.core.kernel.local.ExitStack

class euporie.core.kernel.local.ExitStack

Context manager for dynamic management of a stack of exit callbacks.

For example:
with ExitStack() as stack:

files = [stack.enter_context(open(fname)) for fname in filenames] # All opened files will automatically be closed at the end of # the with statement, even if attempts to open files later # in the list raise an exception.