]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
doc: Link to `string.capwords` from `str.title` (GH-20913)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Thu, 7 Apr 2022 01:57:38 +0000 (18:57 -0700)
committerGitHub <noreply@github.com>
Thu, 7 Apr 2022 01:57:38 +0000 (18:57 -0700)
Since `title()` mentions its own short-comings, it should also mention the library function which does not possess them.

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
(cherry picked from commit b786d9ec52a2c2b0b6627be7fd4a3948c61fbdea)

Co-authored-by: Eric Wieser <wieser.eric@gmail.com>
Doc/library/stdtypes.rst

index d96fb1f2c9ca66ad0fef34c62096d3a2ec64c03a..cf1a638344c8e0309540face32f6ac1fa7b30f6b 100644 (file)
@@ -2118,7 +2118,11 @@ expression support in the :mod:`re` module).
         >>> "they're bill's friends from the UK".title()
         "They'Re Bill'S Friends From The Uk"
 
-   A workaround for apostrophes can be constructed using regular expressions::
+   The :func:`string.capwords` function does not have this problem, as it
+   splits words on spaces only.
+
+   Alternatively, a workaround for apostrophes can be constructed using regular
+   expressions::
 
         >>> import re
         >>> def titlecase(s):