Skip to content

Commit 06bba17

Browse files
committed
Link to references in presentation type tables
1 parent d3d2e81 commit 06bba17

1 file changed

Lines changed: 13 additions & 10 deletions

File tree

Doc/library/string.rst

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -472,10 +472,9 @@ of a number respectively. It can be one of the following:
472472
| | this option is not supported. |
473473
+---------+----------------------------------------------------------+
474474

475-
For a locale-aware separator, use the ``'n'`` presentation type instead.
476-
Note that the locale setting for numeric values must first be set using
477-
the :mod:`locale` module, for example,
478-
``locale.setlocale(locale.LC_NUMERIC, 'en_US')``.
475+
For a locale-aware separator, use the ``'n'``
476+
:ref:`float presentation type <n-format-float>` or
477+
:ref:`integer presentation type <n-format-integer>` instead.
479478

480479
.. versionchanged:: 3.1
481480
Added the ``','`` option (see also :pep:`378`).
@@ -521,12 +520,14 @@ The available integer presentation types are:
521520
| | In case ``'#'`` is specified, the prefix ``'0x'`` will |
522521
| | be upper-cased to ``'0X'`` as well. |
523522
+---------+----------------------------------------------------------+
524-
| ``'n'`` | Number. This is the same as ``'d'``, except that it uses |
523+
| ``'n'`` | .. _n-format-integer: |
524+
| | |
525+
| | Number. This is the same as ``'d'``, except that it uses |
525526
| | the current locale setting to insert the appropriate |
526527
| | digit group separators. Note that the default locale is |
527528
| | not the system locale. Depending on your use case, you |
528-
| | may wish to set ``LC_NUMERIC`` (see the :mod:`locale` |
529-
| | module for more information). |
529+
| | may wish to set :const:`~locale.LC_NUMERIC` using |
530+
| | :func:`locale.setlocale` . |
530531
+---------+----------------------------------------------------------+
531532
| None | The same as ``'d'``. |
532533
+---------+----------------------------------------------------------+
@@ -609,13 +610,15 @@ The available presentation types for :class:`float` and
609610
| | ``'E'`` if the number gets too large. The |
610611
| | representations of infinity and NaN are uppercased, too. |
611612
+---------+----------------------------------------------------------+
612-
| ``'n'`` | Number. This is the same as ``'g'``, except that it uses |
613+
| ``'n'`` | .. _n-format-float: |
614+
| | |
615+
| | Number. This is the same as ``'g'``, except that it uses |
613616
| | the current locale setting to insert the appropriate |
614617
| | digit group separators for the integral part of a |
615618
| | number. Note that the default locale is not the system |
616619
| | locale. Depending on your use case, you may wish to set |
617-
| | ``LC_NUMERIC`` (see the :mod:`locale` module for more |
618-
| | information). |
620+
| | :const:`~locale.LC_NUMERIC` using |
621+
| | :func:`locale.setlocale` . |
619622
+---------+----------------------------------------------------------+
620623
| ``'%'`` | Percentage. Multiplies the number by 100 and displays |
621624
| | in fixed (``'f'``) format, followed by a percent sign. |

0 commit comments

Comments
 (0)