From 9e46e1b05c91c663422d634ca5a2d29fb4b520eb Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com> Date: Mon, 24 Nov 2025 16:28:49 +0200 Subject: [PATCH] [3.14] gh-106318: Add example for str.isalpha() (GH-137557) (#141901) MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Co-authored-by: Adorilson Bezerra Co-authored-by: Éric Co-authored-by: Victor Stinner --- Doc/howto/unicode.rst | 2 ++ Doc/library/stdtypes.rst | 12 ++++++++++++ 2 files changed, 14 insertions(+) diff --git a/Doc/howto/unicode.rst b/Doc/howto/unicode.rst index 254fe7293553..243cc27bac70 100644 --- a/Doc/howto/unicode.rst +++ b/Doc/howto/unicode.rst @@ -352,6 +352,8 @@ If you don't include such a comment, the default encoding used will be UTF-8 as already mentioned. See also :pep:`263` for more information. +.. _unicode-properties: + Unicode Properties ------------------ diff --git a/Doc/library/stdtypes.rst b/Doc/library/stdtypes.rst index 9b1c6a3a744f..7b9f5a69d406 100644 --- a/Doc/library/stdtypes.rst +++ b/Doc/library/stdtypes.rst @@ -2057,6 +2057,18 @@ expression support in the :mod:`re` module). from the `Alphabetic property defined in the section 4.10 'Letters, Alphabetic, and Ideographic' of the Unicode Standard `_. + For example: + + .. doctest:: + + >>> 'Letters and spaces'.isalpha() + False + >>> 'LettersOnly'.isalpha() + True + >>> 'µ'.isalpha() # non-ASCII characters can be considered alphabetical too + True + + See :ref:`unicode-properties`. .. method:: str.isascii() -- 2.47.3