Newbie Database.

Peter Hansen peter at engcorp.com
Tue May 28 07:39:48 EDT 2002


Corey Woodworth wrote:
> 
> donnal at donnal.net (Donnal Walter) wrote in message news:<918bc22f.0205271741.5b64aa4a at posting.google.com>...
> > If you have some reason not to use the built-in pickle module or
> > shelve, you might consider formatting your database using XML (with or
> > without newlines):
> 
> I have no reason. I just don't know much about them.
> 
> > <song>
> >   <name>
> >     Watermark
> >   </name>
> >   <artist>
> >     Enya
> >   </artist>
> > </song>
> 
> I think such a system might be a little verbose. I'm really interested
> in pickle and shelve though. Are there any good intros into them?

Pickle and shelve are effective, though Python-specific.  XML is a
fairly well-supported standard that is 100% cross-platform.  It
has a fairly wide range of sophisticated tools available to work with
it, including extensive support in Python.  It's also an extremely
good technology to know about, whereas pickle and shelve are of
relatively limited use.

Verbose?  Who cares?  How much disk space do you have?  Calculate
the size of your database using the above format and you'll probably
conclude it's really not an issue.  

Now *storing* the data as XML is not always the best approach anyway,
but in that case pickle and shelve are probably not either.  In 
each case you pretty much have to write the entire file over again
just to make a change to, or remove or add anything.  That's where
database systems come in handy.

Not trying to convince you of anything except that "verbose" is
generally a poor reason, even if true, for excluding a useful
technology...  Make it work, then make it fast (or small).  

"We should forget about small efficiencies, say about 97% of 
the time: premature optimization is the root of all evil."
  - Donald Knuth

-Peter



More information about the Python-list mailing list