Re: Dictionary or Database—Please advise

Phlip phlip2005 at gmail.com
Fri Feb 26 23:52:49 CET 2010


On Feb 26, 7:58 am, Jeremy <jlcon... at gmail.com> 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 had wall-to-wall unit tests, you could swap the database in
incrementally ("Deprecation Refactor").

You would just add one database table, switch one client of one
dictionary to use that table, pass all the tests, and integrate.
Repeat until nobody uses the dicts, then trivially retire them.

If you don't have unit tests, then you have a bigger problem than
memory requirements. (You can throw $50 hardware at that!)

--
  Phlip
  http://penbird.tumblr.com/



More information about the Python-list mailing list