expanding persistant objects

Samuel A. Falvo II kc5tja at garnet.armored.net
Mon Mar 27 08:14:28 EST 2000


In article <Pine.GSO.4.10.10003272122090.15009-100000 at sundial>, Moshe Zadka
wrote:
>> i'm worried if i start saving the data one way, when i go
>> to add extra fields i wont be able to load the files anymore.
>
>Pickle (and hence shelve) were designed to deal with this.

Pickle works _perfectly_ for this.  Shelve, in my experience, blows chunks.

The reason is that shelve uses a dbm-type database to store pickled objects
in.  The file it produces is, consequently, a BINARY file, and is therefore
proprietary to the database manager used.

I have had to use the shelve module on several occasions, particularly for
in-house development projects where I work.  Moving databases between
equivalently configured machines (e.g., both running Debian and configured
using apt-get the same way) proved to be a very expensive operation. I found
cases where different versions of same-family dbm libraries couldn't read
older files, and at least two machines couldn't even *FIND* the dbm
libraries, despite having them properly installed.  These were problems of
Windows proportions -- something I'd never seen before on Linux.

I have since switched from using shelves to just plain Pickle files, and
have never, ever had this problem since.

-- 
KC5TJA/6, DM13, QRP-L #1447
Samuel A. Falvo II
Oceanside, CA



More information about the Python-list mailing list