[Zodb-checkins] CVS: Packages/ZConfig/doc - zconfig.tex:1.12
Fred L. Drake, Jr.
fred@zope.com
Thu, 7 Nov 2002 10:29:15 -0500
Update of /cvs-repository/Packages/ZConfig/doc
In directory cvs.zope.org:/tmp/cvs-serv25917/doc
Modified Files:
zconfig.tex
Log Message:
Call string substitution "substitution" instead of "interpolation". As Shane
pointed out, interpolation is a bad name for this, since it implies something
different.
=== Packages/ZConfig/doc/zconfig.tex 1.11 => 1.12 ===
--- Packages/ZConfig/doc/zconfig.tex:1.11 Mon Oct 21 14:59:54 2002
+++ Packages/ZConfig/doc/zconfig.tex Thu Nov 7 10:29:14 2002
@@ -507,10 +507,10 @@
\end{funcdesc}
-\section{\module{ZConfig.Interpolation} --- String interpolation}
+\section{\module{ZConfig.Substitution} --- String substitution}
-\declaremodule{}{ZConfig.Interpolation}
-\modulesynopsis{Shell-style string interpolation helper}
+\declaremodule{}{ZConfig.Substitution}
+\modulesynopsis{Shell-style string substitution helper}
This module provides a basic substitution facility similar to that
found in the Bourne shell (\program{sh} on most \UNIX{} platforms).
@@ -543,40 +543,40 @@
or any type that supports the \method{get()} method of the mapping
protocol.
-\begin{funcdesc}{interpolate}{s, mapping}
- Interpolate values from \var{mapping} into \var{s}. Replacement
+\begin{funcdesc}{substitute}{s, mapping}
+ Substitute values from \var{mapping} into \var{s}. Replacement
values are copied into the result without further interpretation.
- Raises \exception{InterpolationSyntaxError} if there are malformed
+ Raises \exception{SubstitutionSyntaxError} if there are malformed
constructs in \var{s}.
\end{funcdesc}
\begin{funcdesc}{get}{mapping, name\optional{, default}}
- Return the value for \var{name} from \var{mapping}, interpolating
+ Return the value for \var{name} from \var{mapping}, replacing
values recursively if needed. If \var{name} cannot be found in
\var{mapping}, \var{default} is returned without being
- interpolated.
- Raises \exception{InterpolationSyntaxError} if there are malformed
- constructs in \var{s}, or \exception{InterpolationRecursionError} if
+ replaced.
+ Raises \exception{SubstitutionSyntaxError} if there are malformed
+ constructs in \var{s}, or \exception{SubstitutionRecursionError} if
any name expands to include a reference to itself either directly or
indirectly.
\end{funcdesc}
The following exceptions are defined:
-\begin{excdesc}{InterpolationError}
- Base class for errors raised by the \module{ZConfig.Interpolation}
+\begin{excdesc}{SubstitutionError}
+ Base class for errors raised by the \module{ZConfig.Substitution}
module. Instances provide the attributes \member{message} and
\member{context}. \member{message} contains a description of the
error. \member{context} is either \code{None} or a list of names
- that have been looked up in the case of nested interpolation.
+ that have been looked up in the case of nested substitution.
\end{excdesc}
-\begin{excdesc}{InterpolationSyntaxError}
- Raised when interpolation source text contains syntactical errors.
+\begin{excdesc}{SubstitutionSyntaxError}
+ Raised when the source text contains syntactical errors.
\end{excdesc}
-\begin{excdesc}{InterpolationRecursionError}
- Raised when a nested interpolation is recursive. The
+\begin{excdesc}{SubstitutionRecursionError}
+ Raised when a nested substitution is recursive. The
\member{context} attribute will always be a list for this
exception. An additional attribute, \member{name}, gives the name
for which an recursive reference was detected.
@@ -585,18 +585,18 @@
\subsection{Examples}
-These examples show how \function{get()} and \function{interpolate()}
+These examples show how \function{get()} and \function{substitute()}
differ.
\begin{verbatim}
->>> from ZConfig.Interpolation import get, interpolate
+>>> from ZConfig.Substitution import get, substitute
>>> d = {'name': 'value',
... 'top': '$middle',
... 'middle' : 'bottom'}
>>>
->>> interpolate('$name', d)
+>>> substitute('$name', d)
'value'
->>> interpolate('$top', d)
+>>> substitute('$top', d)
'$middle'
>>>
>>> get(d, 'name')