[Python-checkins] doc: Link to `string.capwords` from `str.title` (GH-20913)

miss-islington webhook-mailer at python.org
Wed Apr 6 21:57:43 EDT 2022


https://github.com/python/cpython/commit/85f0792b8fdd86b71844a3ae90ccd7b8d7890012
commit: 85f0792b8fdd86b71844a3ae90ccd7b8d7890012
branch: 3.9
author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com>
committer: miss-islington <31488909+miss-islington at users.noreply.github.com>
date: 2022-04-06T18:57:38-07:00
summary:

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 <jelle.zijlstra at gmail.com>
(cherry picked from commit b786d9ec52a2c2b0b6627be7fd4a3948c61fbdea)

Co-authored-by: Eric Wieser <wieser.eric at gmail.com>

files:
M Doc/library/stdtypes.rst

diff --git a/Doc/library/stdtypes.rst b/Doc/library/stdtypes.rst
index d96fb1f2c9ca6..cf1a638344c8e 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):



More information about the Python-checkins mailing list