diff options
author | INADA Naoki <methane@users.noreply.github.com> | 2018-01-27 05:06:21 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-01-27 05:06:21 (GMT) |
commit | a49ac9902903a798fab4970ccf563c531199c3f8 (patch) | |
tree | 56390f8d6849446b23d3d2a152c6197fc724ae70 /Doc/library | |
parent | 85527cf50a9a4eecaca4022f7c6cb9e0bae1fa5f (diff) | |
download | cpython-a49ac9902903a798fab4970ccf563c531199c3f8.zip cpython-a49ac9902903a798fab4970ccf563c531199c3f8.tar.gz cpython-a49ac9902903a798fab4970ccf563c531199c3f8.tar.bz2 |
bpo-32677: Add .isascii() to str, bytes and bytearray (GH-5342)
Diffstat (limited to 'Doc/library')
-rw-r--r-- | Doc/library/stdtypes.rst | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/Doc/library/stdtypes.rst b/Doc/library/stdtypes.rst index 120b0d3..ad7f578 100644 --- a/Doc/library/stdtypes.rst +++ b/Doc/library/stdtypes.rst @@ -1653,6 +1653,15 @@ expression support in the :mod:`re` module). from the "Alphabetic" property defined in the Unicode Standard. +.. method:: str.isascii() + + Return true if the string is empty or all characters in the string are ASCII, + false otherwise. + ASCII characters have code points in the range U+0000-U+007F. + + .. versionadded:: 3.7 + + .. method:: str.isdecimal() Return true if all characters in the string are decimal @@ -2941,6 +2950,16 @@ place, and instead produce new objects. False +.. method:: bytes.isascii() + bytearray.isascii() + + Return true if the sequence is empty or all bytes in the sequence are ASCII, + false otherwise. + ASCII bytes are in the range 0-0x7F. + + .. versionadded:: 3.7 + + .. method:: bytes.isdigit() bytearray.isdigit() |