From 7429b0abe47a2beb6e0a0d49ae16315b5ceb9c05 Mon Sep 17 00:00:00 2001 From: Eric Wieser Date: Tue, 16 Jun 2020 12:39:22 +0100 Subject: [PATCH 1/4] Link to `string.capwords` from `str.title` Since `title()` mentions its own short-comings, it should also mention the library function which does not possess them. --- Doc/library/stdtypes.rst | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Doc/library/stdtypes.rst b/Doc/library/stdtypes.rst index 7028d240c59ebb4..ad9f7f6bf1746f7 100644 --- a/Doc/library/stdtypes.rst +++ b/Doc/library/stdtypes.rst @@ -2135,8 +2135,12 @@ expression support in the :mod:`re` module). >>> "they're bill's friends from the UK".title() "They'Re Bill'S Friends From The Uk" + + The :func:`string.capwords` function does not have this problem, as it + splits words on spaces first. - A workaround for apostrophes can be constructed using regular expressions:: + Alternatively, a workaround for apostrophes can be constructed using regular + expressions:: >>> import re >>> def titlecase(s): From cc7b77f1144b2753710443151d6d08063ae3523e Mon Sep 17 00:00:00 2001 From: Eric Wieser Date: Mon, 10 Aug 2020 13:57:12 +0100 Subject: [PATCH 2/4] Update Doc/library/stdtypes.rst --- Doc/library/stdtypes.rst | 1 - 1 file changed, 1 deletion(-) diff --git a/Doc/library/stdtypes.rst b/Doc/library/stdtypes.rst index ad9f7f6bf1746f7..e372932249a4e3c 100644 --- a/Doc/library/stdtypes.rst +++ b/Doc/library/stdtypes.rst @@ -2135,7 +2135,6 @@ expression support in the :mod:`re` module). >>> "they're bill's friends from the UK".title() "They'Re Bill'S Friends From The Uk" - The :func:`string.capwords` function does not have this problem, as it splits words on spaces first. From 0a58e85389b10f9eca9e86d0ba9f896df372af50 Mon Sep 17 00:00:00 2001 From: Eric Wieser Date: Mon, 10 Aug 2020 13:57:30 +0100 Subject: [PATCH 3/4] Update Doc/library/stdtypes.rst --- Doc/library/stdtypes.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/Doc/library/stdtypes.rst b/Doc/library/stdtypes.rst index e372932249a4e3c..65889fd8532c071 100644 --- a/Doc/library/stdtypes.rst +++ b/Doc/library/stdtypes.rst @@ -2135,6 +2135,7 @@ expression support in the :mod:`re` module). >>> "they're bill's friends from the UK".title() "They'Re Bill'S Friends From The Uk" + The :func:`string.capwords` function does not have this problem, as it splits words on spaces first. From e829c4cd9793a2d18b9f28337f088536051854c8 Mon Sep 17 00:00:00 2001 From: Eric Wieser Date: Mon, 4 Apr 2022 14:25:56 +0100 Subject: [PATCH 4/4] Update Doc/library/stdtypes.rst Co-authored-by: Jelle Zijlstra --- Doc/library/stdtypes.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Doc/library/stdtypes.rst b/Doc/library/stdtypes.rst index 65889fd8532c071..95f36fde624bafd 100644 --- a/Doc/library/stdtypes.rst +++ b/Doc/library/stdtypes.rst @@ -2137,7 +2137,7 @@ expression support in the :mod:`re` module). "They'Re Bill'S Friends From The Uk" The :func:`string.capwords` function does not have this problem, as it - splits words on spaces first. + splits words on spaces only. Alternatively, a workaround for apostrophes can be constructed using regular expressions::