X-Git-Url: https://wannabe.guru.org/gitweb/?a=blobdiff_plain;f=list_utils.py;h=b65ab0d69fab36196a94b4ef3327fae63b88f48d;hb=822454f580c1ff9eb207b8da46cdfae24e30cde1;hp=b877e381041d32564789232e1bb7329cc04503e6;hpb=444d1e5f3e9a39759079736302e3404018141b02;p=python_utils.git diff --git a/list_utils.py b/list_utils.py index b877e38..b65ab0d 100644 --- a/list_utils.py +++ b/list_utils.py @@ -229,7 +229,9 @@ def _permute(seq: Sequence[Any], path): yield from _permute(cdr, path + car) -def binary_search(lst: Sequence[Any], target: Any, *, sanity_check=False) -> Tuple[bool, int]: +def binary_search( + lst: Sequence[Any], target: Any, *, sanity_check=False +) -> 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