Re: Dictionary or Database—Please advise

Chris Rebert clp2 at
Fri Feb 26 17:29:51 CET 2010

On Fri, Feb 26, 2010 at 7:58 AM, Jeremy <jlconlin at> wrote:
> I have lots of data that I currently store in dictionaries.  However,
> the memory requirements are becoming a problem.  I am considering
> using a database of some sorts instead, but I have never used them
> before.  Would a database be more memory efficient than a dictionary?
> I also need platform independence without having to install a database
> and Python interface on all the platforms I'll be using.  Is there
> something built-in to Python that will allow me to do this?

If you won't be using the SQL features of the database, `shelve` might
be another option; from what I can grok, I sounds like a dictionary
stored mostly on disk rather than entirely in RAM (not 100% sure

It's in the std lib and supports several native dbm libraries for its
backend; one of them should almost always be present.


More information about the Python-list mailing list