[Python-checkins] doc: Link to `string.capwords` from `str.title` (GH-20913)
miss-islington
webhook-mailer at python.org
Wed Apr 6 21:53:09 EDT 2022
https://github.com/python/cpython/commit/ccac6312b9f9d8209646c85492920962fb5704ba
commit: ccac6312b9f9d8209646c85492920962fb5704ba
branch: 3.10
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:52:51-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 f60e936089c23..77b2590860e32 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):
More information about the Python-checkins
mailing list