summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2022-04-07 01:57:38 (GMT)
committerGitHub <noreply@github.com>2022-04-07 01:57:38 (GMT)
commit85f0792b8fdd86b71844a3ae90ccd7b8d7890012 (patch)
tree7cc102b876af3bb667da0a70755d10c0a0043748
parentea6dc5ec08d6efe8b04e4375ad0f14f926ba2188 (diff)
downloadcpython-85f0792b8fdd86b71844a3ae90ccd7b8d7890012.zip
cpython-85f0792b8fdd86b71844a3ae90ccd7b8d7890012.tar.gz
cpython-85f0792b8fdd86b71844a3ae90ccd7b8d7890012.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> (cherry picked from commit b786d9ec52a2c2b0b6627be7fd4a3948c61fbdea) Co-authored-by: Eric Wieser <wieser.eric@gmail.com>
-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 d96fb1f..cf1a638 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):