Index: Doc/c-api/unicode.rst =================================================================== --- Doc/c-api/unicode.rst (revision 63755) +++ Doc/c-api/unicode.rst (working copy) @@ -144,6 +144,13 @@ Return 1 or 0 depending on whether *ch* is an alphanumeric character. +.. cfunction:: int Py_UNICODE_ISPRINTABLE(Py_UNICODE ch) + + Return 1 or 0 depending on whether *ch* is a printable character. + Characters defined in the Unicode character database as "Other" + or "Separator" other than ASCII space(0x20) are not considered + printable. + These APIs can be used for fast direct character conversions: @@ -228,6 +235,9 @@ +===================+=====================+================================+ | :attr:`%%` | *n/a* | The literal % character. | +-------------------+---------------------+--------------------------------+ + | :attr:`%a` | PyObject\* | The result of calling | + | | | :func:`ascii`. | + +-------------------+---------------------+--------------------------------+ | :attr:`%c` | int | A single character, | | | | represented as an C int. | +-------------------+---------------------+--------------------------------+ Index: Doc/library/functions.rst =================================================================== --- Doc/library/functions.rst (revision 63755) +++ Doc/library/functions.rst (working copy) @@ -91,6 +91,14 @@ return False +.. function:: ascii(object) + + As :func:`repr`, return a string containing a printable + representation of an object. But unlike :func:`repr`, the non-ASCII + characters in the string returned by :func:`ascii`() are hex-escaped + to generate a same string as :func:`repr` in Python 2. + + .. function:: bin(x) Convert an integer number to a binary string. The result is a valid Python Index: Doc/library/stdtypes.rst =================================================================== --- Doc/library/stdtypes.rst (revision 63755) +++ Doc/library/stdtypes.rst (working copy) @@ -774,6 +774,14 @@ least one cased character, false otherwise. +.. method:: str.isprintable() + + Return true if all cased characters in the string are printable and there is at + least one cased character, false otherwise. Characters defined in the Unicode + character database as "Other" or "Separator" other than ASCII space(0x20) are + not considered printable. + + .. method:: str.isspace() Return true if there are only whitespace characters in the string and there is