]> 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:52:51 +0000 (18:52 -0700)
committerGitHub <noreply@github.com>
Thu, 7 Apr 2022 01:52:51 +0000 (18:52 -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 f60e936089c232b8ed7193bd266312ede6a99e74..77b2590860e32dc119971fc2c460623748e5d8e3 100644 (file)
@@ -2151,7 +2151,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):