MCPcopy Create free account
hub / github.com/KentBeck/BPlusTree3 / setdefault

Method setdefault

python/bplustree/__init__.py:77–83  ·  view source on GitHub ↗

Get value for key, setting and returning default if not present.

(self, key, default=None)

Source from the content-addressed store, hash-verified

75 raise KeyError("popitem(): tree is empty")
76
77 def setdefault(self, key, default=None):
78 """Get value for key, setting and returning default if not present."""
79 try:
80 return self[key]
81 except KeyError:
82 self[key] = default
83 return default
84
85 def update(self, other):
86 """Update tree with key-value pairs from other mapping or iterable."""

Callers 6

demo_api_compatibilityFunction · 0.95
mainFunction · 0.95

Calls

no outgoing calls