Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 4b49131

Browse files
committed
Commit #1068: new docs for PEP 3101. Also document the old string formatting as "old", and begin documenting str/unicode unification.
1 parent 20594cc commit 4b49131

9 files changed

Lines changed: 513 additions & 389 deletions

File tree

Doc/library/fpformat.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ numbers representations in 100% pure Python.
1212

1313
.. note::
1414

15-
This module is unnecessary: everything here can be done using the ``%`` string
16-
interpolation operator described in the :ref:`string-formatting` section.
15+
This module is unnecessary: everything here can be done using the string
16+
formatting functions described in the :ref:`string-formatting` section.
1717

1818
The :mod:`fpformat` module defines the following functions and an exception:
1919

Doc/library/functions.rst

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -449,6 +449,22 @@ available. They are listed here in alphabetical order.
449449

450450
The float type is described in :ref:`typesnumeric`.
451451

452+
.. function:: format(value[, format_spec])
453+
454+
.. index::
455+
pair: str; format
456+
single: __format__
457+
458+
Convert a string or a number to a "formatted" representation, as controlled
459+
by *format_spec*. The interpretation of *format_spec* will depend on the
460+
type of the *value* argument, however there is a standard formatting syntax
461+
that is used by most built-in types: :ref:`formatspec`.
462+
463+
.. note::
464+
465+
``format(value, format_spec)`` merely calls ``value.__format__(format_spec)``.
466+
467+
452468
.. function:: frozenset([iterable])
453469
:noindex:
454470

@@ -990,10 +1006,9 @@ available. They are listed here in alphabetical order.
9901006

9911007
For more information on strings see :ref:`typesseq` which describes sequence
9921008
functionality (strings are sequences), and also the string-specific methods
993-
described in the :ref:`string-methods` section. To output formatted strings
994-
use template strings or the ``%`` operator described in the
995-
:ref:`string-formatting` section. In addition see the :ref:`stringservices`
996-
section. See also :func:`unicode`.
1009+
described in the :ref:`string-methods` section. To output formatted strings,
1010+
see the :ref:`string-formatting` section. In addition see the
1011+
:ref:`stringservices` section.
9971012

9981013

9991014
.. function:: sum(iterable[, start])

Doc/library/logging.rst

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -611,8 +611,10 @@ This time, all messages with a severity of DEBUG or above were handled, and the
611611
format of the messages was also changed, and output went to the specified file
612612
rather than the console.
613613

614-
Formatting uses standard Python string formatting - see section
615-
:ref:`string-formatting`. The format string takes the following common
614+
.. XXX logging should probably be updated!
615+
616+
Formatting uses the old Python string formatting - see section
617+
:ref:`old-string-formatting`. The format string takes the following common
616618
specifiers. For a complete list of specifiers, consult the :class:`Formatter`
617619
documentation.
618620

@@ -1483,7 +1485,7 @@ A Formatter can be initialized with a format string which makes use of knowledge
14831485
of the :class:`LogRecord` attributes - such as the default value mentioned above
14841486
making use of the fact that the user's message and arguments are pre-formatted
14851487
into a :class:`LogRecord`'s *message* attribute. This format string contains
1486-
standard python %-style mapping keys. See section :ref:`string-formatting`
1488+
standard python %-style mapping keys. See section :ref:`old-string-formatting`
14871489
for more information on string formatting.
14881490

14891491
Currently, the useful mapping keys in a :class:`LogRecord` are:

0 commit comments

Comments
 (0)