shelve in a ZipFile?

Robert Kern rkern at ucsd.edu
Thu Jun 30 22:57:02 EDT 2005


Terry Hancock wrote:
> I only just recently had a look at the shelve module, and it
> looks pretty handy, my only question being, what if I really
> want two shelves?   Must I use two files?
> 
> Also, it seems strange that shelve only works with 
> filenames.  I would've expected there to at least be
> a variant that would put a shelve database on a file
> that is opened for read/write (that is a file object).

shelve uses one of the available dbm modules which are usually coded in 
C and use external libraries. You might subclass Shelf to use a dumbdbm 
(which is in Python) modified to use arbitrary file-like storage.

-- 
Robert Kern
rkern at ucsd.edu

"In the fields of hell where the grass grows high
  Are the graves of dreams allowed to die."
   -- Richard Harter




More information about the Python-list mailing list