On this page
shelve.BsdDbShelf
Up: shelve | Next: shelve.DbfilenameShelf
Rel: shelve.DbfilenameShelf, shelve.open, shelve.Shelf
Ref: docs.python.org — shelve.BsdDbShelf
Tags: #public #python3 #stdlib #shelve
Import
import shelve
from shelve import BsdDbShelf
Signature & Overview
shelve.BsdDbShelf(dict, protocol=None, writeback=False, keyencoding='utf-8')
Shelf implementation using the "BSD" db interface.
Methods & Attributes
BsdDbShelf.clear(self)— D.clear() -> None. Remove all items from D.BsdDbShelf.close(self)—BsdDbShelf.closemethod/property.BsdDbShelf.first(self)—BsdDbShelf.firstmethod/property.BsdDbShelf.get(self, key, default=None)—BsdDbShelf.getmethod/property.BsdDbShelf.items(self)— D.items() -> a set-like object providing a view on D's itemsBsdDbShelf.keys(self)— D.keys() -> a set-like object providing a view on D's keysBsdDbShelf.last(self)—BsdDbShelf.lastmethod/property.BsdDbShelf.next(self)—BsdDbShelf.nextmethod/property.BsdDbShelf.pop(self, key, default=<object object at 0x1040b41c0>)— value. If key is not found, d is returned if given, otherwise KeyError is raised.BsdDbShelf.popitem(self)— as a 2-tuple; but raise KeyError if D is empty.BsdDbShelf.previous(self)—BsdDbShelf.previousmethod/property.BsdDbShelf.set_location(self, key)—BsdDbShelf.set_locationmethod/property.BsdDbShelf.setdefault(self, key, default=None)— D.setdefault(k[,d]) -> D.get(k,d), also set D[k]=d if k not in DBsdDbShelf.sync(self)—BsdDbShelf.syncmethod/property.BsdDbShelf.update(self, other=(), /, **kwds)— If E present and has a .keys() method, does: for k in E.keys(): D[k] = E[k] If E present and lacks .keys() method, does:BsdDbShelf.values(self)— D.values() -> an object providing a view on D's values
Usage
import shelve
assert issubclass(shelve.BsdDbShelf, shelve.Shelf)
Gotchas
- Legacy BSD DB subclass: Prefer
shelve.open()(orsqlite3for concurrent/portable persistence).
REPL Inspect
from shelve import BsdDbShelf
help(BsdDbShelf)
Linked from
Related notes
- tuts/python3/stdlib_module/shelve/DbfilenameShelf Linked here; links to this page; shared tags: #shelve, #stdlib
- tuts/python3/stdlib_module/shelve/open Linked here; links to this page; shared tags: #shelve, #stdlib
- tuts/python3/stdlib_module/shelve/Shelf Linked here; links to this page; shared tags: #shelve, #stdlib
- tuts/python3/stdlib_module/shelve Linked here; links to this page; shared tags: #stdlib
- tuts/c/stdlib shared tags: #stdlib
- tuts/c/stdlib/assert shared tags: #stdlib
- tuts/c/stdlib/assert/assert shared tags: #stdlib
- tuts/c/stdlib/assert/static_assert shared tags: #stdlib
- tuts/c/stdlib/ctype shared tags: #stdlib
- tuts/c/stdlib/ctype/isalpha shared tags: #stdlib