From: Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> Date: Thu, 7 Apr 2022 01:57:38 +0000 (-0700) Subject: doc: Link to `string.capwords` from `str.title` (GH-20913) X-Git-Tag: v3.9.13~125 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=85f0792b8fdd86b71844a3ae90ccd7b8d7890012;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 d96fb1f2c9ca..cf1a638344c8 100644 --- a/Doc/library/stdtypes.rst +++ b/Doc/library/stdtypes.rst @@ -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):