Skip to content

Commit 3304cbd

Browse files
authored
Doc: Fix alphabetical ordering of removeprefix/suffix. (GH-22194)
1 parent 06d0b8b commit 3304cbd

File tree

1 file changed

+28
-27
lines changed

1 file changed

+28
-27
lines changed

Doc/library/stdtypes.rst

Lines changed: 28 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1568,33 +1568,6 @@ expression support in the :mod:`re` module).
15681568
interpreted as in slice notation.
15691569

15701570

1571-
.. method:: str.removeprefix(prefix, /)
1572-
1573-
If the string starts with the *prefix* string, return
1574-
``string[len(prefix):]``. Otherwise, return a copy of the original
1575-
string::
1576-
1577-
>>> 'TestHook'.removeprefix('Test')
1578-
'Hook'
1579-
>>> 'BaseTestCase'.removeprefix('Test')
1580-
'BaseTestCase'
1581-
1582-
.. versionadded:: 3.9
1583-
1584-
.. method:: str.removesuffix(suffix, /)
1585-
1586-
If the string ends with the *suffix* string and that *suffix* is not empty,
1587-
return ``string[:-len(suffix)]``. Otherwise, return a copy of the
1588-
original string::
1589-
1590-
>>> 'MiscTests'.removesuffix('Tests')
1591-
'Misc'
1592-
>>> 'TmpDirMixin'.removesuffix('Tests')
1593-
'TmpDirMixin'
1594-
1595-
.. versionadded:: 3.9
1596-
1597-
15981571
.. method:: str.encode(encoding="utf-8", errors="strict")
15991572

16001573
Return an encoded version of the string as a bytes object. Default encoding
@@ -1909,6 +1882,34 @@ expression support in the :mod:`re` module).
19091882
the string itself, followed by two empty strings.
19101883

19111884

1885+
.. method:: str.removeprefix(prefix, /)
1886+
1887+
If the string starts with the *prefix* string, return
1888+
``string[len(prefix):]``. Otherwise, return a copy of the original
1889+
string::
1890+
1891+
>>> 'TestHook'.removeprefix('Test')
1892+
'Hook'
1893+
>>> 'BaseTestCase'.removeprefix('Test')
1894+
'BaseTestCase'
1895+
1896+
.. versionadded:: 3.9
1897+
1898+
1899+
.. method:: str.removesuffix(suffix, /)
1900+
1901+
If the string ends with the *suffix* string and that *suffix* is not empty,
1902+
return ``string[:-len(suffix)]``. Otherwise, return a copy of the
1903+
original string::
1904+
1905+
>>> 'MiscTests'.removesuffix('Tests')
1906+
'Misc'
1907+
>>> 'TmpDirMixin'.removesuffix('Tests')
1908+
'TmpDirMixin'
1909+
1910+
.. versionadded:: 3.9
1911+
1912+
19121913
.. method:: str.replace(old, new[, count])
19131914

19141915
Return a copy of the string with all occurrences of substring *old* replaced by

0 commit comments

Comments
 (0)