From 546fb5f2fb2d45b3a968c906ae4f8c33c831a704 Mon Sep 17 00:00:00 2001 From: Adorilson Bezerra Date: Sun, 21 Mar 2021 22:35:52 -0300 Subject: [PATCH 1/4] gh-106318: Add examples for str.isnumeric() --- Doc/library/stdtypes.rst | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/Doc/library/stdtypes.rst b/Doc/library/stdtypes.rst index 3899e5b59d8852..bd8f62de563065 100644 --- a/Doc/library/stdtypes.rst +++ b/Doc/library/stdtypes.rst @@ -2156,6 +2156,20 @@ expression support in the :mod:`re` module). VULGAR FRACTION ONE FIFTH. Formally, numeric characters are those with the property value Numeric_Type=Digit, Numeric_Type=Decimal or Numeric_Type=Numeric. + For example:: + + >>> '0123456789'.isnumeric() + True + >>> '٠١٢٣٤٥٦٧٨٩'.isnumeric() #ARABIC-INDIC DIGIT ZERO TO NINE + True + >>> '⅕'.isnumeric() # VULGAR FRACTION ONE FIFTH + True + >>> '²'.isdigit(), '²'.isdecimal(), '²'.isnumeric() + (True, False, True) + + See also :meth:`isdecimal` and :meth:`isdigit`. Numeric characters is a + decimal numbers superset. + .. method:: str.isprintable() From fc87e3cf9dea530d5411d8d8ae6894366439be8b Mon Sep 17 00:00:00 2001 From: Adorilson Bezerra Date: Sat, 13 Dec 2025 19:28:35 +0000 Subject: [PATCH 2/4] gh-106318: Add doctest role for str.isnumeric() examples --- Doc/library/stdtypes.rst | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/Doc/library/stdtypes.rst b/Doc/library/stdtypes.rst index bd8f62de563065..d2f4d3e6437226 100644 --- a/Doc/library/stdtypes.rst +++ b/Doc/library/stdtypes.rst @@ -2155,19 +2155,20 @@ expression support in the :mod:`re` module). that have the Unicode numeric value property, e.g. U+2155, VULGAR FRACTION ONE FIFTH. Formally, numeric characters are those with the property value Numeric_Type=Digit, Numeric_Type=Decimal or Numeric_Type=Numeric. + For example: - For example:: + .. doctest:: >>> '0123456789'.isnumeric() True - >>> '٠١٢٣٤٥٦٧٨٩'.isnumeric() #ARABIC-INDIC DIGIT ZERO TO NINE + >>> '٠١٢٣٤٥٦٧٨٩'.isnumeric() # Arabic-indic digit zero to nine True - >>> '⅕'.isnumeric() # VULGAR FRACTION ONE FIFTH + >>> '⅕'.isnumeric() # Vulgar fraction one fifth True - >>> '²'.isdigit(), '²'.isdecimal(), '²'.isnumeric() - (True, False, True) + >>> '²'.isdecimal(), '²'.isdigit(), '²'.isnumeric() + (False, True, True) - See also :meth:`isdecimal` and :meth:`isdigit`. Numeric characters is a + See also :meth:`isdecimal` and :meth:`isdigit`. Numeric characters are decimal numbers superset. From 1efeb8c80fa121d90cee198fd5fd2c79c43371ab Mon Sep 17 00:00:00 2001 From: Adorilson Bezerra Date: Sun, 14 Dec 2025 18:05:41 +0000 Subject: [PATCH 3/4] Update Doc/library/stdtypes.rst Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com> --- 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 d2f4d3e6437226..10af98b4ecc410 100644 --- a/Doc/library/stdtypes.rst +++ b/Doc/library/stdtypes.rst @@ -2161,9 +2161,9 @@ expression support in the :mod:`re` module). >>> '0123456789'.isnumeric() True - >>> '٠١٢٣٤٥٦٧٨٩'.isnumeric() # Arabic-indic digit zero to nine + >>> '٠١٢٣٤٥٦٧٨٩'.isnumeric() # Arabic-indic digit zero to nine True - >>> '⅕'.isnumeric() # Vulgar fraction one fifth + >>> '⅕'.isnumeric() # Vulgar fraction one fifth True >>> '²'.isdecimal(), '²'.isdigit(), '²'.isnumeric() (False, True, True) From 2fa4ab32071003f25884250fd9563f9830ef8f5b Mon Sep 17 00:00:00 2001 From: Adorilson Bezerra Date: Sun, 14 Dec 2025 18:05:51 +0000 Subject: [PATCH 4/4] Update Doc/library/stdtypes.rst Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com> --- 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 10af98b4ecc410..a0b78f8053764b 100644 --- a/Doc/library/stdtypes.rst +++ b/Doc/library/stdtypes.rst @@ -2169,7 +2169,7 @@ expression support in the :mod:`re` module). (False, True, True) See also :meth:`isdecimal` and :meth:`isdigit`. Numeric characters are - decimal numbers superset. + a superset of decimal numbers. .. method:: str.isprintable()