-
-
Notifications
You must be signed in to change notification settings - Fork 32.1k
bpo-29549: Fixes docstring for str.index #256
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you. The "Like something else" docstring have been regularly bothering me.
@@ -11687,7 +11687,11 @@ unicode_hash(PyObject *self) | |||
PyDoc_STRVAR(index__doc__, | |||
"S.index(sub[, start[, end]]) -> int\n\ | |||
\n\ | |||
Like S.find() but raise ValueError when the substring is not found."); | |||
Return the lowest index in S where substring sub is found, \n\ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Space before the newline
@@ -542,7 +542,11 @@ _Py_bytes_find(const char *str, Py_ssize_t len, PyObject *args) | |||
PyDoc_STRVAR_shared(_Py_index__doc__, | |||
"B.index(sub[, start[, end]]) -> int\n\ | |||
\n\ | |||
Like B.find() but raise ValueError when the subsection is not found."); | |||
Return the lowest index in B where subsection sub is found,\n\ | |||
such that sub is contained within B[start,end]. Optional\n\ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Needs a colon, not a comma: B[start:end]
(I presume these errors were copied from the “find” and “rfind” doc strings; they could also be fixed there, but at least don’t repeat the errors)
* Updates B.index documentation. * Updates str.index documentation, makes it Argument Clinic compatible. * Removes ArgumentClinic code. * Finishes string.index documentation. * Updates string.rindex documentation. * Documents B.rindex. (cherry picked from commit 43ba886)
PR for https://bugs.python.org/issue29549