Skip to content

Commit

Permalink
pythongh-67206: Document that string.printable is not printable in …
Browse files Browse the repository at this point in the history
…the POSIX sense (python#128820)
  • Loading branch information
picnixz authored Jan 14, 2025
1 parent d786ac7 commit d906bde
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
13 changes: 10 additions & 3 deletions Doc/library/string.rst
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,18 @@ The constants defined in this module are:
String of ASCII characters which are considered punctuation characters
in the ``C`` locale: ``!"#$%&'()*+,-./:;<=>?@[\]^_`{|}~``.


.. data:: printable

String of ASCII characters which are considered printable. This is a
combination of :const:`digits`, :const:`ascii_letters`, :const:`punctuation`,
and :const:`whitespace`.
String of ASCII characters which are considered printable by Python.
This is a combination of :const:`digits`, :const:`ascii_letters`,
:const:`punctuation`, and :const:`whitespace`.

.. note::

By design, :meth:`string.printable.isprintable() <str.isprintable>`
returns :const:`False`. In particular, ``string.printable`` is not
printable in the POSIX sense (see :manpage:`LC_CTYPE <locale(5)>`).


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

0 comments on commit d906bde

Please sign in to comment.