Please I need help with Shelves!!

Thomas Wouters thomas at xs4all.net
Tue Aug 8 08:16:07 EDT 2000


On Tue, Aug 08, 2000 at 12:41:05AM -0400, Cristian Echeverria wrote:

> > 1. If I do make_shelve(1000) I get a file with 1000 integers
> > with size 7168 bytes, if then I do clean_shelve() key and data
> > are deleted, but the file is still 7168 bytes, in fact key and
> > data are still there but I can´t use them.

That's an artifact of the underlying DB (dbm, ndbm, gdbm, whatever).

> > 2. If I do make_shelve(10000) I get a file with 10000 integers
> > with size 44032 bytes.
> > But if I do the next:
> > make_shelve(5000)
> > for i in range(10): change_shelve(500)
> > I get a file with 10000 integers too, but this time the size
> > is 52736 bytes.

Same as 1)

The price you pay for the O(almost-1) (or something similarly small) speed
of db-files is the file size, and the fact that it's usually not shrinkable.
It doesn't have anything to do with your script, but with the underlying
files. If you want something more flexible, try a SQL engine, like Gadfly.

-- 
Thomas Wouters <thomas at xs4all.net>

Hi! I'm a .signature virus! copy me into your .signature file to help me spread!




More information about the Python-list mailing list