summaryrefslogtreecommitdiffstats
path: root/Doc
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2006-05-18 07:20:05 (GMT)
committerGeorg Brandl <georg@python.org>2006-05-18 07:20:05 (GMT)
commit007a382a4db14d471d71a709501439531221c01f (patch)
tree894f4e07f795495ebdf87fb543ec92129db9919a /Doc
parent7b90e168f3d27f10cc087da2b9be1289722e7172 (diff)
downloadcpython-007a382a4db14d471d71a709501439531221c01f.zip
cpython-007a382a4db14d471d71a709501439531221c01f.tar.gz
cpython-007a382a4db14d471d71a709501439531221c01f.tar.bz2
Bug #1490688: properly document %e, %f, %g format subtleties.
Diffstat (limited to 'Doc')
-rw-r--r--Doc/lib/libstdtypes.tex41
1 files changed, 30 insertions, 11 deletions
diff --git a/Doc/lib/libstdtypes.tex b/Doc/lib/libstdtypes.tex
index ab3a838..6760e47 100644
--- a/Doc/lib/libstdtypes.tex
+++ b/Doc/lib/libstdtypes.tex
@@ -970,20 +970,22 @@ The conversion types are:
\lineiii{u}{Unsigned decimal.}{}
\lineiii{x}{Unsigned hexadecimal (lowercase).}{(2)}
\lineiii{X}{Unsigned hexadecimal (uppercase).}{(2)}
- \lineiii{e}{Floating point exponential format (lowercase).}{}
- \lineiii{E}{Floating point exponential format (uppercase).}{}
- \lineiii{f}{Floating point decimal format.}{}
- \lineiii{F}{Floating point decimal format.}{}
- \lineiii{g}{Same as \character{e} if exponent is greater than -4 or
- less than precision, \character{f} otherwise.}{}
- \lineiii{G}{Same as \character{E} if exponent is greater than -4 or
- less than precision, \character{F} otherwise.}{}
+ \lineiii{e}{Floating point exponential format (lowercase).}{(3)}
+ \lineiii{E}{Floating point exponential format (uppercase).}{(3)}
+ \lineiii{f}{Floating point decimal format.}{(3)}
+ \lineiii{F}{Floating point decimal format.}{(3)}
+ \lineiii{g}{Floating point format. Uses exponential format
+ if exponent is greater than -4 or less than precision,
+ decimal format otherwise.}{(4)}
+ \lineiii{G}{Floating point format. Uses exponential format
+ if exponent is greater than -4 or less than precision,
+ decimal format otherwise.}{(4)}
\lineiii{c}{Single character (accepts integer or single character
string).}{}
\lineiii{r}{String (converts any python object using
- \function{repr()}).}{(3)}
+ \function{repr()}).}{(5)}
\lineiii{s}{String (converts any python object using
- \function{str()}).}{(4)}
+ \function{str()}).}{(6)}
\lineiii{\%}{No argument is converted, results in a \character{\%}
character in the result.}{}
\end{tableiii}
@@ -1003,10 +1005,27 @@ Notes:
formatting of the number if the leading character of the result is
not already a zero.
\item[(3)]
- The \code{\%r} conversion was added in Python 2.0.
+ The alternate form causes the result to always contain a decimal
+ point, even if no digits follow it.
+
+ The precision determines the number of digits after the decimal
+ point and defaults to 6.
\item[(4)]
+ The alternate form causes the result to always contain a decimal
+ point, and trailing zeroes are not removed as they would
+ otherwise be.
+
+ The precision determines the number of significant digits before
+ and after the decimal point and defaults to 6.
+ \item[(5)]
+ The \code{\%r} conversion was added in Python 2.0.
+
+ The precision determines the maximal number of characters used.
+ \item[(6)]
If the object or format provided is a \class{unicode} string,
the resulting string will also be \class{unicode}.
+
+ The precision determines the maximal number of characters used.
\end{description}
% XXX Examples?