New submission from Windson Yang <wiwind...@outlook.com>:
bisect_left should be similar to bisect_right. However, the current implement didn't reflect it. A little bit update for the bisect_left function could make the user easy to understand their relation. def bisect_left(a, x, lo=0, hi=None): if lo < 0: raise ValueError('lo must be non-negative') if hi is None: hi = len(a) while lo < hi: mid = (lo+hi)//2 # <= should be the only difference between bisect_left and bisect_right if x <= a[mid]: hi = mid else: lo = mid+1 return lo ---------- components: Library (Lib) messages: 355606 nosy: Windson Yang priority: normal severity: normal status: open title: small change at bisect_left function for easy understanding versions: Python 3.8 _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue38626> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com