stash: implement __len__

Part of the MutableMapping abc (though we can't actually implement
that).
This commit is contained in:
Ran Benita
2021-07-18 14:59:16 +03:00
parent 5470d33e82
commit 5f39e31736
2 changed files with 11 additions and 0 deletions

View File

@@ -123,3 +123,7 @@ class Stash:
def __contains__(self, key: StashKey[T]) -> bool:
"""Return whether key was set."""
return key in self._storage
def __len__(self) -> int:
"""Return how many items exist in the stash."""
return len(self._storage)