-
-
Notifications
You must be signed in to change notification settings - Fork 32.2k
Fix error in docstrings in bisect module #21422
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
The docstrings for `bisect_right()` and `bisect_left()` contain sample code that has a bug: `a.insert(x)` should be `a.insert(i, x)`.
|
Thanks for your contribution @ic4f . |
|
Thank you for approving/merging! |
The docstrings for `bisect_right()` and `bisect_left()` contain sample code that has a bug: `a.insert(x)` should be `a.insert(i, x)`.
The docstrings for `bisect_right()` and `bisect_left()` contain sample code that has a bug: `a.insert(x)` should be `a.insert(i, x)`.
The docstrings for `bisect_right()` and `bisect_left()` contain sample code that has a bug: `a.insert(x)` should be `a.insert(i, x)`.
|
@ic4f One thing I noticed in this docstring. Is this correct to say? If a[i:] includes e, and i is the left-most value in the list, then isn't it true instead that: |
|
@petulla, I suppose the alternative wording is not wrong. However, the original seems more correct to me. I think the implied meaning here is insertion point, not insertion index - i.e., if I think of it as a row of items, I'll be inserting before or after an item, not in place of an item (which would be a swap). So, it describes the end result of the insert operation - i.e., what the resulting sequence will be, not the first step in the algorithm to achieve that sequence (in which case insertion index would be appropriate). |
|
I see, that makes sense. The wording as it is confusing though. I don't think it articulates that case. It does seem like it's giving the insertion point, i, where the element already exists. |
|
If the wording seems not quite right, you might consider opening an issue, see what the community thinks. There's hardly a perfectly worded docstring :) |
|
Where can issues be opened? I only saw the possibility for PRs, which I'm happy to do but an issue would be best. |
|
The issue tracker: https://bugs.python.org/. Also, this is very helpful as a general intro: https://devguide.python.org/#contributing |
|
I agree with @ic4f , open an issue on bpo or email python-dev with your suggestions if you want. |


The docstrings for
bisect_right()andbisect_left()contain sample code that has a bug:a.insert(x)should bea.insert(i, x).Not creating/citing an issue as this is minor.