Message355606
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 |
|
Date |
User |
Action |
Args |
2019-10-29 03:03:16 | Windson Yang | set | recipients:
+ Windson Yang |
2019-10-29 03:03:16 | Windson Yang | set | messageid: <1572318196.84.0.0964323507502.issue38626@roundup.psfhosted.org> |
2019-10-29 03:03:16 | Windson Yang | link | issue38626 messages |
2019-10-29 03:03:16 | Windson Yang | create | |
|