From d69df4b3ee270843840ec6b25e12af6026f22090 Mon Sep 17 00:00:00 2001 From: Adorilson Bezerra Date: Sun, 14 Mar 2021 23:17:08 -0300 Subject: [PATCH 1/3] gh-106318: Add example for str.isascii() --- Doc/library/stdtypes.rst | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/Doc/library/stdtypes.rst b/Doc/library/stdtypes.rst index a81a6704142dcc..bcbd5fa1f7aafe 100644 --- a/Doc/library/stdtypes.rst +++ b/Doc/library/stdtypes.rst @@ -1998,6 +1998,19 @@ expression support in the :mod:`re` module). ``False`` otherwise. ASCII characters have code points in the range U+0000-U+007F. + For example:: + + >>> 'a commom word'.isascii() + True + >>> 'acommomword'.isascii() + True + >>> 'µ'.isascii() + False + >>> 'æ'.isascii() + False + >>> 'Ŧ'.isascii() + False + .. versionadded:: 3.7 From 33f5bd067d5fa8faff04fc7a3f1c1c74772b9f5d Mon Sep 17 00:00:00 2001 From: Adorilson Bezerra Date: Fri, 8 Aug 2025 23:10:36 +0100 Subject: [PATCH 2/3] gh-106318: Make example for str.isascii() shorter Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com> --- Doc/library/stdtypes.rst | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/Doc/library/stdtypes.rst b/Doc/library/stdtypes.rst index bcbd5fa1f7aafe..9c2efe6f0337ea 100644 --- a/Doc/library/stdtypes.rst +++ b/Doc/library/stdtypes.rst @@ -2000,16 +2000,10 @@ expression support in the :mod:`re` module). For example:: - >>> 'a commom word'.isascii() - True - >>> 'acommomword'.isascii() + >>> 'a common word'.isascii() True >>> 'µ'.isascii() False - >>> 'æ'.isascii() - False - >>> 'Ŧ'.isascii() - False .. versionadded:: 3.7 From 7b2f53741c82930c44e786894637618501dbfc79 Mon Sep 17 00:00:00 2001 From: Adorilson Bezerra Date: Sat, 9 Aug 2025 20:49:18 +0100 Subject: [PATCH 3/3] gh-106318: Add doctest role to str.isascii() doc --- Doc/library/stdtypes.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Doc/library/stdtypes.rst b/Doc/library/stdtypes.rst index 9c2efe6f0337ea..e5e3fb05ae65d5 100644 --- a/Doc/library/stdtypes.rst +++ b/Doc/library/stdtypes.rst @@ -1996,9 +1996,9 @@ expression support in the :mod:`re` module). Return ``True`` if the string is empty or all characters in the string are ASCII, ``False`` otherwise. - ASCII characters have code points in the range U+0000-U+007F. + ASCII characters have code points in the range U+0000-U+007F. For example: - For example:: + .. doctest:: >>> 'a common word'.isascii() True