3.17.1 Restrictions

class Shelf( dict[, protocol=None[, writeback=False]])
A subclass of UserDict.DictMixin which stores pickled values in the dict object.

By default, version 0 pickles are used to serialize values. The version of the pickle protocol can be specified with the protocol parameter. See the pickle documentation for a discussion of the pickle protocols. Changed in version 2.3: The protocol parameter was added.

If the writeback parameter is True, the object will hold a cache of all entries accessed and write them back to the dict at sync and close times. This allows natural operations on mutable entries, but can consume much more memory and make sync and close take a long time.

class BsdDbShelf( dict[, protocol=None[, writeback=False]])

A subclass of Shelf which exposes first, next, previous, last and set_location which are available in the bsddb module but not in other database modules. The dict object passed to the constructor must support those methods. This is generally accomplished by calling one of bsddb.hashopen, bsddb.btopen or bsddb.rnopen. The optional protocol and writeback parameters have the same interpretation as for the Shelf class.

class DbfilenameShelf( filename[, flag='c'[, protocol=None[, writeback=False]]])

A subclass of Shelf which accepts a filename instead of a dict-like object. The underlying file will be opened using anydbm.open. By default, the file will be created and opened for both read and write. The optional flag parameter has the same interpretation as for the open function. The optional protocol and writeback parameters have the same interpretation as for the Shelf class.

See About this document... for information on suggesting changes.