Fast persistent dictionary

Alex Martelli aleax at
Fri Oct 4 21:13:18 CEST 2002

?????? ?. wrote:

> I need a fairly fast and simple persistent dictionary for use in
> a Python program. I'll only store two string values for each key
> (a string also). It's important that the contents of the dictionary are
> saved to disk as soon as possible so to survive system failures in a
> consistent state.

Modules dbm &c should be fairly close to your specs (the Berkeley
variant may be best) except they only store one string per value
(and per key) -- maybe you can identify a character that never
occurs in the first string and use it to paste the two together,
with that character as the separator (or short substring, if no
single character will do).  Not sure about the "save to disk as
soon as possible", but recent versions of Copycat's Berkeley DB
appear to give you a lot of options, maybe including exactly the
one you want.


More information about the Python-list mailing list