summaryrefslogtreecommitdiff
path: root/Objects/bytes_methods.c
diff options
context:
space:
mode:
authorLisa Roach <lisaroach14@gmail.com>2017-04-04 22:36:22 -0700
committerRaymond Hettinger <rhettinger@users.noreply.github.com>2017-04-04 22:36:22 -0700
commit43ba8861e0ad044efafa46a7cc04e12ac5df640e (patch)
treef39fbc3083f506fd8d1ac57bcb690b6f89732edc /Objects/bytes_methods.c
parent257b980b316a5206ecf6c23b958e2b7c4df4f3de (diff)
downloadcpython-git-43ba8861e0ad044efafa46a7cc04e12ac5df640e.tar.gz
bpo-29549: Fixes docstring for str.index (#256)
* 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.
Diffstat (limited to 'Objects/bytes_methods.c')
-rw-r--r--Objects/bytes_methods.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/Objects/bytes_methods.c b/Objects/bytes_methods.c
index 85d9ceea52..bd79773a54 100644
--- a/Objects/bytes_methods.c
+++ b/Objects/bytes_methods.c
@@ -546,7 +546,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\
+arguments start and end are interpreted as in slice notation.\n\
+\n\
+Raises ValueError when the subsection is not found.");
PyObject *
_Py_bytes_index(const char *str, Py_ssize_t len, PyObject *args)
@@ -583,7 +587,11 @@ _Py_bytes_rfind(const char *str, Py_ssize_t len, PyObject *args)
PyDoc_STRVAR_shared(_Py_rindex__doc__,
"B.rindex(sub[, start[, end]]) -> int\n\
\n\
-Like B.rfind() but raise ValueError when the subsection is not found.");
+Return the highest index in B where subsection sub is found,\n\
+such that sub is contained within B[start,end]. Optional\n\
+arguments start and end are interpreted as in slice notation.\n\
+\n\
+Raise ValueError when the subsection is not found.");
PyObject *
_Py_bytes_rindex(const char *str, Py_ssize_t len, PyObject *args)
@@ -815,4 +823,3 @@ PyDoc_STRVAR_shared(_Py_zfill__doc__,
"\n"
"Pad a numeric string B with zeros on the left, to fill a field\n"
"of the specified width. B is never truncated.");
-