Permalink
Browse files

Added bisect methods to the KeysView

  • Loading branch information...
1 parent 21c891f commit dbd2f9bf97d8198c7cf01d42db958273937d2e5c @DanielStutzbach committed Jan 31, 2011
Showing with 5 additions and 0 deletions.
  1. +5 −0 _sorteddict.py
View
5 _sorteddict.py
@@ -17,6 +17,11 @@ def count(self, key):
return self._mapping.count(key)
def _from_iterable(cls, it):
return sortedset(key=self._mapping._sortedkeys.key)
+ def bisect_left(self, key):
+ return self._mapping._sortedkeys.bisect_left(key)
+ def bisect_right(self, key):
+ return self._mapping._sortedkeys.bisect_right(key)
+ bisect = bisect_right
class ItemsView(collections.ItemsView, collections.Sequence):
def __getitem__(self, index):

0 comments on commit dbd2f9b

Please sign in to comment.