How to avoid computation every time a python module is reloaded

This my Answer to the stackoverflow question: How to avoid computation every time a python module is reloaded:

You can use a shelve to store your data on disc instead of loading the whole data into memory. So startup time will be very fast, but the trade-off will be slower access time.

Shelve will pickle the dict values too, but will do the (un)pickle not at startup for all the items, but only at access time for each item itself.