From: Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> Date: Thu, 7 Apr 2022 01:52:51 +0000 (-0700) Subject: doc: Link to `string.capwords` from `str.title` (GH-20913) X-Git-Tag: v3.10.5~190 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=ccac6312b9f9d8209646c85492920962fb5704ba;p=thirdparty%2FPython%2Fcpython.git doc: Link to `string.capwords` from `str.title` (GH-20913) Since `title()` mentions its own short-comings, it should also mention the library function which does not possess them. Co-authored-by: Jelle Zijlstra (cherry picked from commit b786d9ec52a2c2b0b6627be7fd4a3948c61fbdea) Co-authored-by: Eric Wieser --- diff --git a/Doc/library/stdtypes.rst b/Doc/library/stdtypes.rst index f60e936089c2..77b2590860e3 100644 --- a/Doc/library/stdtypes.rst +++ b/Doc/library/stdtypes.rst @@ -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):