Add an option to the file interface that lets users perform atomic writes, in an easier and less error-prone way.
Examples, for context:
- python - How to make file creation an atomic operation? - Stack Overflow
- How to prevent a block of code from being interrupted by KeyboardInterrupt in Python? - Stack Overflow
- python - Threadsafe and fault-tolerant file writes - Stack Overflow
- python - Is it possible to prevent SIGINT breaking for a code section? - Stack Overflow
- python - Avoiding corrupting JSON during save to file in case of power outages - Stack Overflow
- python - How to do atomic file replacement? - Stack Overflow
There was an atomicwrites package, but it’s abandoned.