generated from pyiron/pyiron_module_template
-
Notifications
You must be signed in to change notification settings - Fork 0
Closed
Labels
enhancementNew feature or requestNew feature or request
Description
contextlib.ExitStack
provides a with
context onto which we can slap callbacks for when the context is exited. However, these all always fire when the context is exited.
Sometimes in pyiron_workflow
, I have a series of operations that make progressive modifications to some state, but if I encounter an error I want to go back and revert whatever changes have been made so far before raising the error. Right now I manually handle these callbacks, but It seems to me like this is a special case of ExitStack
, "ExceptionStack
" maybe.
This can be pretty easily constructed as a custom context manager and I thought it might be a nice addition here.
Feeback from anyone/@pmrv?
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request