Commit 6a390b34 authored by Raymond Hettinger's avatar Raymond Hettinger

SF 1602378 Clarify docstrings for bisect

parent d6030acd
...@@ -23,8 +23,8 @@ def bisect_right(a, x, lo=0, hi=None): ...@@ -23,8 +23,8 @@ def bisect_right(a, x, lo=0, hi=None):
"""Return the index where to insert item x in list a, assuming a is sorted. """Return the index where to insert item x in list a, assuming a is sorted.
The return value i is such that all e in a[:i] have e <= x, and all e in The return value i is such that all e in a[:i] have e <= x, and all e in
a[i:] have e > x. So if x already appears in the list, i points just a[i:] have e > x. So if x already appears in the list, a.insert(x) will
beyond the rightmost x already there. insert just after the rightmost x already there.
Optional args lo (default 0) and hi (default len(a)) bound the Optional args lo (default 0) and hi (default len(a)) bound the
slice of a to be searched. slice of a to be searched.
...@@ -62,8 +62,8 @@ def bisect_left(a, x, lo=0, hi=None): ...@@ -62,8 +62,8 @@ def bisect_left(a, x, lo=0, hi=None):
"""Return the index where to insert item x in list a, assuming a is sorted. """Return the index where to insert item x in list a, assuming a is sorted.
The return value i is such that all e in a[:i] have e < x, and all e in The return value i is such that all e in a[:i] have e < x, and all e in
a[i:] have e >= x. So if x already appears in the list, i points just a[i:] have e >= x. So if x already appears in the list, a.insert(x) will
before the leftmost x already there. insert just before the leftmost x already there.
Optional args lo (default 0) and hi (default len(a)) bound the Optional args lo (default 0) and hi (default len(a)) bound the
slice of a to be searched. slice of a to be searched.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment