Prevent python shelve corruption
Question: How should I prevent corruption in a shelve file? Should the shelve be closed
most of the time and then opened only when I need to read or edit a value?


Answer: If safety of your persistent objects is of high importance in your project,
using `shelve` is not a good idea. Neither is pickling objects and manually
writing them into files.

Consider that real databases invest huge resources (brainpower and code) to be
safe in case of failures. So keep your data in a real DB. The simplest would
be `sqlite`, as it comes bundled with Python. `sqlite` is quite safe and has a
lot of smarts in it about keeping your data in some valid state even in case
of system failures (like when someone trips on your PC's power cable).

