diff options
author | Sergey Golitsynskiy <sgolitsynskiy@gmail.com> | 2020-07-11 23:18:31 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-07-11 23:18:31 (GMT) |
commit | 6a1e9c26736259413b060b01d1cb52fcf82c0385 (patch) | |
tree | 97cdc21140485c2e880e4c32f3ea0bbab67beb92 /Lib/bisect.py | |
parent | 344dce312a0cf86d5a5772d54843cc179acaf6e3 (diff) | |
download | cpython-6a1e9c26736259413b060b01d1cb52fcf82c0385.zip cpython-6a1e9c26736259413b060b01d1cb52fcf82c0385.tar.gz cpython-6a1e9c26736259413b060b01d1cb52fcf82c0385.tar.bz2 |
Fix error in docstrings in bisect module (GH-21422)
The docstrings for `bisect_right()` and `bisect_left()` contain sample
code that has a bug: `a.insert(x)` should be `a.insert(i, x)`.
Diffstat (limited to 'Lib/bisect.py')
-rw-r--r-- | Lib/bisect.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/Lib/bisect.py b/Lib/bisect.py index 8f3f6a3..8336a4e 100644 --- a/Lib/bisect.py +++ b/Lib/bisect.py @@ -16,7 +16,7 @@ def bisect_right(a, x, lo=0, hi=None): """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 - a[i:] have e > x. So if x already appears in the list, a.insert(x) will + a[i:] have e > x. So if x already appears in the list, a.insert(i, x) will insert just after the rightmost x already there. Optional args lo (default 0) and hi (default len(a)) bound the @@ -51,7 +51,7 @@ def bisect_left(a, x, lo=0, hi=None): """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 - a[i:] have e >= x. So if x already appears in the list, a.insert(x) will + a[i:] have e >= x. So if x already appears in the list, a.insert(i, x) will insert just before the leftmost x already there. Optional args lo (default 0) and hi (default len(a)) bound the |