This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author Windson Yang
Recipients Windson Yang
Date 2019-10-29.03:03:16
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1572318196.84.0.0964323507502.issue38626@roundup.psfhosted.org>
In-reply-to
Content
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
History
Date User Action Args
2019-10-29 03:03:16Windson Yangsetrecipients: + Windson Yang
2019-10-29 03:03:16Windson Yangsetmessageid: <1572318196.84.0.0964323507502.issue38626@roundup.psfhosted.org>
2019-10-29 03:03:16Windson Yanglinkissue38626 messages
2019-10-29 03:03:16Windson Yangcreate