From c367466c182b072f03bb5c6e388047818c193d88 Mon Sep 17 00:00:00 2001 From: Adorilson Bezerra Date: Mon, 24 Nov 2025 14:10:35 +0000 Subject: [PATCH] [3.13] gh-106318: Add example for str.isalpha() (GH-137557) (cherry picked from commit 0387a8e0f773c5f60c089b3801898eb34c49cacd) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Adorilson Bezerra Co-authored-by: Éric Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com> 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 254fe729355353..243cc27bac7025 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 df431a83972b78..b942118d67fb9b 100644 --- a/Doc/library/stdtypes.rst +++ b/Doc/library/stdtypes.rst @@ -1921,6 +1921,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()