diff options
Diffstat (limited to 'Doc')
-rw-r--r-- | Doc/library/array.rst | 8 | ||||
-rw-r--r-- | Doc/whatsnew/3.10.rst | 7 |
2 files changed, 13 insertions, 2 deletions
diff --git a/Doc/library/array.rst b/Doc/library/array.rst index ff3ec6b..18a768d 100644 --- a/Doc/library/array.rst +++ b/Doc/library/array.rst @@ -178,11 +178,15 @@ The following data items and methods are also supported: array of some other type. -.. method:: array.index(x) +.. method:: array.index(x[, start[, stop]]) Return the smallest *i* such that *i* is the index of the first occurrence of - *x* in the array. + *x* in the array. The optional arguments *start* and *stop* can be + specified to search for *x* within a subsection of the array. Raise + :exc:`ValueError` if *x* is not found. + .. versionchanged:: 3.10 + Added optional *start* and *stop* parameters. .. method:: array.insert(i, x) diff --git a/Doc/whatsnew/3.10.rst b/Doc/whatsnew/3.10.rst index b84bcf9..eb42480 100644 --- a/Doc/whatsnew/3.10.rst +++ b/Doc/whatsnew/3.10.rst @@ -633,6 +633,13 @@ argparse Misleading phrase "optional arguments" was replaced with "options" in argparse help. Some tests might require adaptation if they rely on exact output match. (Contributed by Raymond Hettinger in :issue:`9694`.) +array +----- + +The :meth:`~array.array.index` method of :class:`array.array` now has +optional *start* and *stop* parameters. +(Contributed by Anders Lorentsen and Zackery Spytz in :issue:`31956`.) + base64 ------ |