Skip to content

Commit d906bde

Browse files
authored
gh-67206: Document that string.printable is not printable in the POSIX sense (#128820)
1 parent d786ac7 commit d906bde

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

Doc/library/string.rst

+10-3
Original file line numberDiff line numberDiff line change
@@ -59,11 +59,18 @@ The constants defined in this module are:
5959
String of ASCII characters which are considered punctuation characters
6060
in the ``C`` locale: ``!"#$%&'()*+,-./:;<=>?@[\]^_`{|}~``.
6161

62+
6263
.. data:: printable
6364

64-
String of ASCII characters which are considered printable. This is a
65-
combination of :const:`digits`, :const:`ascii_letters`, :const:`punctuation`,
66-
and :const:`whitespace`.
65+
String of ASCII characters which are considered printable by Python.
66+
This is a combination of :const:`digits`, :const:`ascii_letters`,
67+
:const:`punctuation`, and :const:`whitespace`.
68+
69+
.. note::
70+
71+
By design, :meth:`string.printable.isprintable() <str.isprintable>`
72+
returns :const:`False`. In particular, ``string.printable`` is not
73+
printable in the POSIX sense (see :manpage:`LC_CTYPE <locale(5)>`).
6774

6875

6976
.. data:: whitespace
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Document that :const:`string.printable` is not printable in the POSIX sense.
2+
In particular, :meth:`string.printable.isprintable() <str.isprintable>` returns
3+
:const:`False`. Patch by Bénédikt Tran.

0 commit comments

Comments
 (0)