Mercurial > cpython-lru_cache-weakref
diff Doc/lib/libstdtypes.tex @ 21542:5d4135609efc legacy-trunk
Added index entries similar to some recommended by Skip, and used the word
"interpolation" in the text, to make the string formatting material easier to
find.
This closes SF bug #487165.
Bugfix: this should be applied for Python 2.2.1.
| author | Fred Drake <fdrake@acm.org> |
|---|---|
| date | Wed, 26 Dec 2001 20:06:40 +0000 |
| parents | fbbd8a4ca7a6 |
| children | c901d158ad68 e24ba04d01b0 |
line wrap: on
line diff
--- a/Doc/lib/libstdtypes.tex Wed Dec 26 19:55:14 2001 +0000 +++ b/Doc/lib/libstdtypes.tex Wed Dec 26 20:06:40 2001 +0000 @@ -681,20 +681,24 @@ \subsubsection{String Formatting Operations \label{typesseq-strings}} \index{formatting, string (\%{})} +\index{interpolation, string (\%{})} \index{string!formatting} +\index{string!interpolation} \index{printf-style formatting} \index{sprintf-style formatting} \index{\protect\%{} formatting} +\index{\protect\%{} interpolation} String and Unicode objects have one unique built-in operation: the -\code{\%} operator (modulo). Given \code{\var{format} \% -\var{values}} (where \var{format} is a string or Unicode object), -\code{\%} conversion specifications in \var{format} are replaced with -zero or more elements of \var{values}. The effect is similar to the -using \cfunction{sprintf()} in the C language. If \var{format} is a -Unicode object, or if any of the objects being converted using the -\code{\%s} conversion are Unicode objects, the result will be a -Unicode object as well. +\code{\%} operator (modulo). This is also known as the string +\emph{formatting} or \emph{interpolation} operator. Given +\code{\var{format} \% \var{values}} (where \var{format} is a string or +Unicode object), \code{\%} conversion specifications in \var{format} +are replaced with zero or more elements of \var{values}. The effect +is similar to the using \cfunction{sprintf()} in the C language. If +\var{format} is a Unicode object, or if any of the objects being +converted using the \code{\%s} conversion are Unicode objects, the +result will be a Unicode object as well. If \var{format} requires a single argument, \var{values} may be a single non-tuple object. \footnote{A tuple object in this case should
