diff options
| author | Scott Gasch <[email protected]> | 2022-06-04 22:35:03 -0700 |
|---|---|---|
| committer | Scott Gasch <[email protected]> | 2022-06-04 22:35:03 -0700 |
| commit | 3794ba43f9661e9093af70728ae8614caea65f1f (patch) | |
| tree | 644cce68030aaee12a16089a916158cd44e2a334 /list_utils.py | |
| parent | 903843730a9916105352c729e94136a755b5e529 (diff) | |
Get rid of sanity check on bsearch; just use __debug__.
Diffstat (limited to 'list_utils.py')
| -rw-r--r-- | list_utils.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/list_utils.py b/list_utils.py index 1141af2..8f92be3 100644 --- a/list_utils.py +++ b/list_utils.py @@ -259,7 +259,7 @@ def scramble(seq: MutableSequence[Any]) -> MutableSequence[Any]: return shuffle(seq) -def binary_search(lst: Sequence[Any], target: Any, *, sanity_check=False) -> Tuple[bool, int]: +def binary_search(lst: Sequence[Any], target: Any) -> Tuple[bool, int]: """Performs a binary search on lst (which must already be sorted). Returns a Tuple composed of a bool which indicates whether the target was found and an int which indicates the index closest to @@ -285,7 +285,7 @@ def binary_search(lst: Sequence[Any], target: Any, *, sanity_check=False) -> Tup AssertionError """ - if sanity_check: + if __debug__: last = None for x in lst: if last is not None: |
