summaryrefslogtreecommitdiffstats
path: root/Doc/lib/libstdtypes.tex
diff options
context:
space:
mode:
authorFred Drake <fdrake@acm.org>2000-11-17 19:44:14 (GMT)
committerFred Drake <fdrake@acm.org>2000-11-17 19:44:14 (GMT)
commit17383b9ad77071b2a15cf3286353281e04e139d2 (patch)
tree8176cc8ee9dd9d933643a8a6c0a1a9ed9178951c /Doc/lib/libstdtypes.tex
parent977fe96a055ab9867d1e61ff5ad7799e55fdfbd2 (diff)
downloadcpython-17383b9ad77071b2a15cf3286353281e04e139d2.zip
cpython-17383b9ad77071b2a15cf3286353281e04e139d2.tar.gz
cpython-17383b9ad77071b2a15cf3286353281e04e139d2.tar.bz2
Added information about the %r string formatting conversion. Added note
about the interpretation of radix 0 for int(), and added description of the optional radix argument for long(). Based on comments from Reuben Sumner <rasumner@users.sourceforge.net>. This closes bug #121672.
Diffstat (limited to 'Doc/lib/libstdtypes.tex')
-rw-r--r--Doc/lib/libstdtypes.tex10
1 files changed, 6 insertions, 4 deletions
diff --git a/Doc/lib/libstdtypes.tex b/Doc/lib/libstdtypes.tex
index 003a454..91dd675 100644
--- a/Doc/lib/libstdtypes.tex
+++ b/Doc/lib/libstdtypes.tex
@@ -601,15 +601,17 @@ The right argument should be a tuple with one item for each argument
required by the format string; if the string requires a single
argument, the right argument may also be a single non-tuple
object.\footnote{A tuple object in this case should be a singleton.
-} The following format characters are understood:
-\code{\%}, \code{c}, \code{s}, \code{i}, \code{d}, \code{u}, \code{o},
-\code{x}, \code{X}, \code{e}, \code{E}, \code{f}, \code{g}, \code{G}.
+} The following format characters are understood: \code{\%},
+\code{c}, \code{r}, \code{s}, \code{i}, \code{d}, \code{u}, \code{o},
+\code{x}, \code{X}, \code{e}, \code{E}, \code{f}, \code{g}, \code{G}.
Width and precision may be a \code{*} to specify that an integer argument
specifies the actual width or precision. The flag characters
\code{-}, \code{+}, blank, \code{\#} and \code{0} are understood. The
size specifiers \code{h}, \code{l} or \code{L} may be present but are
ignored. The \code{\%s} conversion takes any Python object and
-converts it to a string using \code{str()} before formatting it. The
+converts it to a string using \code{str()} before formatting it; the
+\code{\%r} conversion is similar but applies the \function{repr()}
+function instead. The
ANSI features \code{\%p} and \code{\%n} are not supported. Since
Python strings have an explicit length, \code{\%s} conversions don't
assume that \code{'\e0'} is the end of the string.