From 70e23463b6564e2d981a652aa87df395bd01e02e Mon Sep 17 00:00:00 2001 From: Adorilson Bezerra Date: Sun, 14 Mar 2021 23:46:08 -0300 Subject: [PATCH 1/2] gh-106318: Add example for str.isdecimal() --- Doc/library/stdtypes.rst | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/Doc/library/stdtypes.rst b/Doc/library/stdtypes.rst index a81a6704142dcc..1046dabc676751 100644 --- a/Doc/library/stdtypes.rst +++ b/Doc/library/stdtypes.rst @@ -2008,7 +2008,16 @@ expression support in the :mod:`re` module). otherwise. Decimal characters are those that can be used to form numbers in base 10, e.g. U+0660, ARABIC-INDIC DIGIT ZERO. Formally a decimal character is a character in the Unicode - General Category "Nd". + General Category "Nd". For example:: + + .. doctest:: + + >>> '0123456789'.isdecimal() + True + >>> '٠١٢٣٤٥٦٧٨٩'.isdecimal() # ARABIC-INDIC DIGIT ZERO TO NINE + True + >>> 'alphabetic'.isdecimal() + False .. method:: str.isdigit() @@ -2020,7 +2029,6 @@ expression support in the :mod:`re` module). like the Kharosthi numbers. Formally, a digit is a character that has the property value Numeric_Type=Digit or Numeric_Type=Decimal. - .. method:: str.isidentifier() Return ``True`` if the string is a valid identifier according to the language From a0595a8c57c06619430701bbc61df47c04dafdaa Mon Sep 17 00:00:00 2001 From: Adorilson Bezerra Date: Sat, 9 Aug 2025 20:15:25 +0100 Subject: [PATCH 2/2] gh-106318: Resolve conflit with doctest role and add a blank line --- Doc/library/stdtypes.rst | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Doc/library/stdtypes.rst b/Doc/library/stdtypes.rst index 1046dabc676751..f8ff392a7f2ccf 100644 --- a/Doc/library/stdtypes.rst +++ b/Doc/library/stdtypes.rst @@ -2008,7 +2008,7 @@ expression support in the :mod:`re` module). otherwise. Decimal characters are those that can be used to form numbers in base 10, e.g. U+0660, ARABIC-INDIC DIGIT ZERO. Formally a decimal character is a character in the Unicode - General Category "Nd". For example:: + General Category "Nd". For example: .. doctest:: @@ -2029,6 +2029,7 @@ expression support in the :mod:`re` module). like the Kharosthi numbers. Formally, a digit is a character that has the property value Numeric_Type=Digit or Numeric_Type=Decimal. + .. method:: str.isidentifier() Return ``True`` if the string is a valid identifier according to the language