Remembering

Lonnie Princehouse fnord at u.washington.edu
Mon Dec 22 19:08:39 EST 2003


I wrote a simple persistent dictionary class that may be of use
to you.  I find it quite handy.  

http://magicpeacefarm.com/lonnie/py/diskt.py

Basically, it uses pickle to store the contents of the dictionary
in a directory on the filesystem instead of in memory. 
Consider this example:

Python 2.2.2 (#1, Feb 24 2003, 19:13:11)
[GCC 3.2.2 20030222 (Red Hat Linux 3.2.2-4)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from diskt import diskt
>>> stuff = diskt()
>>> stuff['foo'] = 'bar'

... exit Python and restart ...

Python 2.2.2 (#1, Feb 24 2003, 19:13:11)
[GCC 3.2.2 20030222 (Red Hat Linux 3.2.2-4)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from diskt import diskt
>>> stuff = diskt()
>>> print stuff['foo']
bar


(much lighter-weight than things like the ZODB :P)




More information about the Python-list mailing list