shelve(writeback=true) danger...

Skip Montanaro skip at pobox.com
Wed Oct 15 17:32:21 EDT 2003


    Matthew> I'm going to use shelve to work with some large dicts, and I'm
    Matthew> going to use writeback=True to make sure all the edits get
    Matthew> written back to the file when I close it.  Is there a way to
    Matthew> force a writeback without closing?  It would be nice if I could
    Matthew> occasionally flush the caches in memory and write everything
    Matthew> back to files without having to close and reopen my shelf.

Sure, you can call db.sync() explicitly.  Try

    import shelve
    help(shelve)

from the interpreter prompt and note the last three paragraphs of the
DESCRIPTION section.

Skip





More information about the Python-list mailing list