In many systems, transactions are used to group operations together so that they are atomic—meaning they either all succeed or all fail. However, in Python itself does not seem to have built-in support for transactions outside of the context of databases
For example I have two functions as follows:
create_user_record(user_record)
create_directory(directory_name)
I want to wrap these functions in an operation in which if one of them fails, the other fails too. How can I achieve this?