Remove all items from the tree.
(self)
| 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.""" |