]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
doc: Link to `string.capwords` from `str.title` (GH-20913)
authorEric Wieser <wieser.eric@gmail.com>
Thu, 7 Apr 2022 01:31:39 +0000 (02:31 +0100)
committerGitHub <noreply@github.com>
Thu, 7 Apr 2022 01:31:39 +0000 (18:31 -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>
Doc/library/stdtypes.rst

index d6d90cd462c224c3cf27464f7594fa450626bc17..f25e8303f94a24952a5561438de845b6466fc944 100644 (file)
@@ -2189,7 +2189,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):