summaryrefslogtreecommitdiffstats
path: root/Doc/library
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2022-04-07 01:52:51 (GMT)
committerGitHub <noreply@github.com>2022-04-07 01:52:51 (GMT)
commitccac6312b9f9d8209646c85492920962fb5704ba (patch)
treea85ae0100b8f3319dd14dc59029f2a30d5b7ed58 /Doc/library
parentb217ba7371a780ad014e4ed5695ab8d0a2ea588e (diff)
downloadcpython-ccac6312b9f9d8209646c85492920962fb5704ba.zip
cpython-ccac6312b9f9d8209646c85492920962fb5704ba.tar.gz
cpython-ccac6312b9f9d8209646c85492920962fb5704ba.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>
Diffstat (limited to 'Doc/library')
-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 f60e936..77b2590 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):