Skip to content
Snippets Groups Projects
Commit 7839c758 authored by Piotr Maślanka's avatar Piotr Maślanka
Browse files

added bool to SortedList

parent 3453fd0f
No related branches found
No related tags found
No related merge requests found
# v2.7.48 # v2.7.48
* added __bool__ to `SortedList`
\ No newline at end of file
__version__ = '2.7.48_a1' __version__ = '2.7.48_a2'
...@@ -23,6 +23,9 @@ class SortedList(tp.Generic[T]): ...@@ -23,6 +23,9 @@ class SortedList(tp.Generic[T]):
self.keys = collections.deque(a[0] for a in sort) # type: collections.deque[int] self.keys = collections.deque(a[0] for a in sort) # type: collections.deque[int]
self.key = key # type: tp.Callable[[T], int] self.key = key # type: tp.Callable[[T], int]
def __bool__(self) -> bool:
return bool(self.items)
def __contains__(self, item: T) -> bool: def __contains__(self, item: T) -> bool:
return item in self.items return item in self.items
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment