Am Freitag, den 01.07.2005, 10:53 -0700 schrieb Scott David Daniels: > 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.
It's even worse: shelve is basically a class that wraps a dictionary. It provides a dictionary string -> pickable object based on a dictioary string -> string. bsddb, gdbm etc. probably access files via lowlevel calls that are not interceptable. One way to achieve your goals would be to add compression and/or a key prefix (which would allow multiple dictionaries or at least key spaces in one file) Andreas > > --Scott David Daniels > [EMAIL PROTECTED]
signature.asc
Description: Dies ist ein digital signierter Nachrichtenteil
-- http://mail.python.org/mailman/listinfo/python-list