Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > hi,everyone. a problem with shelve Module

Reply
Thread Tools

hi,everyone. a problem with shelve Module

 
 
softwindow
Guest
Posts: n/a
 
      05-26-2006
according to the book instruduction , i use shelve Module to write
record to file.

i only write ten records like this:

name sex age

jim male 22
tom male 23
lucy female 21

.................................................. others( about ten
records)

but i find the size of this file .oh my god , it is about 24k

the file is too large ! is it normal ?

i don't dare to think that if i has 1000 records , it will be a very
large file!

 
Reply With Quote
 
 
 
 
skip@pobox.com
Guest
Posts: n/a
 
      05-26-2006

>> i only write ten records like this:


>> name sex age


>> jim male 22
>> tom male 23
>> lucy female 21

...

>> but i find the size of this file .oh my god , it is about 24k


>> the file is too large ! is it normal ?


Yes. It's the nature of packages like Berkeley DB, gdbm and dbm (the
packages mediate access to the database file under the covers) that they
trade space for time. The files they create are not simple text files.
They are organized to permit quick access to records by key and to permit
average time fast insertion.

Skip
 
Reply With Quote
 
 
 
 
Laszlo Nagy
Guest
Posts: n/a
 
      05-26-2006
http://www.velocityreviews.com/forums/(E-Mail Removed) i'rta:
> >> i only write ten records like this:

>
> >> name sex age

>
> >> jim male 22
> >> tom male 23
> >> lucy female 21

> ...
>
> >> but i find the size of this file .oh my god , it is about 24k

>
> >> the file is too large ! is it normal ?

>
> Yes. It's the nature of packages like Berkeley DB, gdbm and dbm (the
> packages mediate access to the database file under the covers) that they
> trade space for time.

Sometimes you add records but the size of the database does not
change...
> The files they create are not simple text files.
> They are organized to permit quick access to records by key and to permit
> average time fast insertion.
>
> Skip
>


 
Reply With Quote
 
softwindow
Guest
Posts: n/a
 
      05-26-2006
really

in which case?

 
Reply With Quote
 
Jim Segrave
Guest
Posts: n/a
 
      05-26-2006
In article <(E-Mail Removed) .com>,
softwindow <(E-Mail Removed)> wrote:
[some context restored]
>> Sometimes you add records but the size of the database does not
>> change...

>really
>
>in which case?


whenever the database is big enough to add them without it's having to
grow




--
Jim Segrave ((E-Mail Removed))

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Is safe to use the shelve module with eventlet? Alex Python 0 06-28-2010 12:51 PM
Shelve or pickle module Guillaume Bog Python 0 05-18-2008 03:14 AM
Question: Best Practice? (module 'shelve') Thomas Ploch Python 0 01-10-2007 12:51 AM
oddness in shelve module Michael P. Soulier Python 2 06-22-2005 07:35 PM
using shelve module to create web databases....problems? PiedmontBiz Python 0 06-13-2004 09:16 PM



Advertisments