]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Doc: Fix alphabetical ordering of removeprefix/suffix. (GH-22194)
authorBenjamin Peterson <benjamin@python.org>
Thu, 10 Sep 2020 23:59:02 +0000 (18:59 -0500)
committerGitHub <noreply@github.com>
Thu, 10 Sep 2020 23:59:02 +0000 (08:59 +0900)
Doc/library/stdtypes.rst

index 5a10faa7bbd293b7506231bdfaa35c9dc84c3997..0ffe7b7526fa768722cfeb591c2e9bf1dd7361d7 100644 (file)
@@ -1568,33 +1568,6 @@ expression support in the :mod:`re` module).
    interpreted as in slice notation.
 
 
-.. method:: str.removeprefix(prefix, /)
-
-   If the string starts with the *prefix* string, return
-   ``string[len(prefix):]``. Otherwise, return a copy of the original
-   string::
-
-      >>> 'TestHook'.removeprefix('Test')
-      'Hook'
-      >>> 'BaseTestCase'.removeprefix('Test')
-      'BaseTestCase'
-
-   .. versionadded:: 3.9
-
-.. method:: str.removesuffix(suffix, /)
-
-   If the string ends with the *suffix* string and that *suffix* is not empty,
-   return ``string[:-len(suffix)]``. Otherwise, return a copy of the
-   original string::
-
-      >>> 'MiscTests'.removesuffix('Tests')
-      'Misc'
-      >>> 'TmpDirMixin'.removesuffix('Tests')
-      'TmpDirMixin'
-
-   .. versionadded:: 3.9
-
-
 .. method:: str.encode(encoding="utf-8", errors="strict")
 
    Return an encoded version of the string as a bytes object. Default encoding
@@ -1909,6 +1882,34 @@ expression support in the :mod:`re` module).
    the string itself, followed by two empty strings.
 
 
+.. method:: str.removeprefix(prefix, /)
+
+   If the string starts with the *prefix* string, return
+   ``string[len(prefix):]``. Otherwise, return a copy of the original
+   string::
+
+      >>> 'TestHook'.removeprefix('Test')
+      'Hook'
+      >>> 'BaseTestCase'.removeprefix('Test')
+      'BaseTestCase'
+
+   .. versionadded:: 3.9
+
+
+.. method:: str.removesuffix(suffix, /)
+
+   If the string ends with the *suffix* string and that *suffix* is not empty,
+   return ``string[:-len(suffix)]``. Otherwise, return a copy of the
+   original string::
+
+      >>> 'MiscTests'.removesuffix('Tests')
+      'Misc'
+      >>> 'TmpDirMixin'.removesuffix('Tests')
+      'TmpDirMixin'
+
+   .. versionadded:: 3.9
+
+
 .. method:: str.replace(old, new[, count])
 
    Return a copy of the string with all occurrences of substring *old* replaced by