summaryrefslogtreecommitdiffstats
path: root/Doc
diff options
context:
space:
mode:
authorEric Wieser <wieser.eric@gmail.com>2022-04-07 01:31:39 (GMT)
committerGitHub <noreply@github.com>2022-04-07 01:31:39 (GMT)
commitb786d9ec52a2c2b0b6627be7fd4a3948c61fbdea (patch)
tree8692f392897842684250b1ad44114b288f42dae3 /Doc
parent1da9c38fd352465fd3d1a00e64dc90444b421730 (diff)
downloadcpython-b786d9ec52a2c2b0b6627be7fd4a3948c61fbdea.zip
cpython-b786d9ec52a2c2b0b6627be7fd4a3948c61fbdea.tar.gz
cpython-b786d9ec52a2c2b0b6627be7fd4a3948c61fbdea.tar.bz2
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@gmail.com>
Diffstat (limited to 'Doc')
-rw-r--r--Doc/library/stdtypes.rst6
1 files changed, 5 insertions, 1 deletions
diff --git a/Doc/library/stdtypes.rst b/Doc/library/stdtypes.rst
index d6d90cd..f25e830 100644
--- a/Doc/library/stdtypes.rst
+++ b/Doc/library/stdtypes.rst
@@ -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):