Commit ea49de34 authored by Fred Drake's avatar Fred Drake

minor cleanup of example

parent ff381e13
...@@ -48,12 +48,14 @@ level can look for a variable \code{user.spam_verbose}, as follows: ...@@ -48,12 +48,14 @@ level can look for a variable \code{user.spam_verbose}, as follows:
\begin{verbatim} \begin{verbatim}
import user import user
try:
verbose = user.spam_verbose # user's verbosity preference verbose = bool(getattr(user, "spam_verbose", 0))
except AttributeError:
verbose = 0 # default verbosity
\end{verbatim} \end{verbatim}
(The three-argument form of \function{getattr()} is used in case
the user has not defined \code{spam_verbose} in their
\file{.pythonrc.py} file.)
Programs with extensive customization needs are better off reading a Programs with extensive customization needs are better off reading a
program-specific customization file. program-specific customization file.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment