FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

[3.15] gh-106318: Add examples to the `str.isdigit()` method docs (GH-144721) by miss-islington · Pull Request #151082 · python/cpython · GitHub

Repository navigation

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .rst  (1) All 1 file type selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
23 changes: 19 additions & 4 deletions Doc/library/stdtypes.rst
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -2174,9 +2174,25 @@ expression support in the :mod:`re` module).
character, ``False`` otherwise. Digits include decimal characters and digits that need
special handling, such as the compatibility superscript digits.
This covers digits which cannot be used to form numbers in base 10,
like the Kharosthi numbers. Formally, a digit is a character that has the
like the `Kharosthi numbers <https://en.wikipedia.org/wiki/Kharosthi#Numerals>`__.
Formally, a digit is a character that has the
property value Numeric_Type=Digit or Numeric_Type=Decimal.

For example:

.. doctest::

>>> '0123456789'.isdigit()
True
>>> '٠١٢٣٤٥٦٧٨٩'.isdigit() # Arabic-Indic digits zero to nine
True
>>> '⅕'.isdigit() # Vulgar fraction one fifth
False
>>> '²'.isdecimal(), '²'.isdigit(), '²'.isnumeric()
(False, True, True)

See also :meth:`isdecimal` and :meth:`isnumeric`.


.. method:: str.isidentifier()

Expand Down Expand Up @@ -2217,15 +2233,14 @@ expression support in the :mod:`re` module).

>>> '0123456789'.isnumeric()
True
>>> '٠١٢٣٤٥٦٧٨٩'.isnumeric() # Arabic-indic digit zero to nine
>>> '٠١٢٣٤٥٦٧٨٩'.isnumeric() # Arabic-Indic digits zero to nine
True
>>> '⅕'.isnumeric() # Vulgar fraction one fifth
True
>>> '²'.isdecimal(), '²'.isdigit(), '²'.isnumeric()
(False, True, True)

See also :meth:`isdecimal` and :meth:`isdigit`. Numeric characters are
a superset of decimal numbers.
See also :meth:`isdecimal` and :meth:`isdigit`.


.. method:: str.isprintable()
Expand Down
Loading

Back | FazBrowse Home | New Git URL