shelve: writing out updates?!

phil hunt zen19725 at zen.co.uk
Sun Jul 31 07:38:14 CEST 2005


On Sat, 30 Jul 2005 17:57:17 -0700, Robert Kern <rkern at ucsd.edu> wrote:
>Paul Rubin wrote:
>> Shelve uses dbm and pickle to make a persistent object store.  The
>> "db" in "dbm" stands for "database" and while I didn't expect full
>> ACID capability, I'd have thought there'd be at least some minimum
>> gesture towards durability of updates.  But say that s is a shelve
>> object.  If I say
>> 
>>    s[whatever] = value
>> 
>> there is no way apparent from the shelve docs to get the update
>> flushed out to the disk file until the shelve is actually closed.  If
>> I'm using the shelve to store stuff in a long-running server, it could
>> be months before the shelve closes.
>> 
>> Is shelve really missing this capability?  
>
>No. Call the .sync() method. Unfortunately, the shelve module is not 
>well-documented.

Obviously it's good when stuff is well documented. 

I wonder if the barrier to good documentation is set too high?
If i wanted to add some documentation here, I'd have to download the 
current source for the latest Python documentation, download, 
install and learn the code that processes the source documentation, 
write my changes then send the results into the CVS. (I'm assuming 
that's roughly correct -- I haven't actually done it).

The point is, that would be a major effort, too major to merely add 
a few lines detailing the .sync method.

But, what if the Python documentation was on a Wiki? Then it would 
be easy to update! Of course, we would have to guard against false 
or malicious updates, but Wikipedia manage that OK. The 
Documentation Wiki could then be used as a basis for the "official" 
documentation that comes with each new release.

Does this idea make some sense? Or are there hidden pitfalls?

-- 
Email: zen19725 at zen dot co dot uk





More information about the Python-list mailing list