gh-67206: Document that string.printable is not printable in the POSIX sense (#128820)

This commit is contained in:
Bénédikt Tran 2025-01-14 17:07:37 +01:00 committed by GitHub
parent d786ac7f58
commit d906bde250
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 13 additions and 3 deletions

View file

@ -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

View file

@ -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.