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

Method clear

python/bplustree/__init__.py:41–49  ·  view source on GitHub ↗

Remove all items from the tree.

(self)

Source from the content-addressed store, hash-verified

39 yield value
40
41 def clear(self):
42 """Remove all items from the tree."""
43 # C extension doesn't have clear method, so remove keys one by one
44 # Use while loop to avoid issues with iterator invalidation
45 while len(self) > 0:
46 # Get first key and delete it
47 for key in self.keys():
48 del self[key]
49 break
50
51 def pop(self, key, *args):
52 """Remove and return value for key with optional default."""

Calls 1

keysMethod · 0.95