shelve in a ZipFile?

Scott David Daniels Scott.Daniels at Acm.Org
Fri Jul 1 13:53:04 EDT 2005


Terry Hancock wrote:
> I only just recently had a look at the shelve module....
> That would be handy if, for example, I wanted to couple
> (and compress into the bargain) by putting my two
> shelf files into a single zip archive.

You are, however, fooling yourself if you think a shelve
solution can be made to gracefully interact with a zip-
compressed version.  In order to zip the shelve data, it
must all be seen in a pass, so every update would necessarily
rewrite the entire shelve storage.  much better to extract the
entire shelve file, operate on it, and re-compress it.

Even if uncompressed, the zip archive format is not going to
happily allow you to change the size of any of the "files" it
stores.

--Scott David Daniels
Scott.Daniels at Acm.Org



More information about the Python-list mailing list