Thanks to visit codestin.com Credit goes to github.com
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent ff381e1 commit ea49de3Copy full SHA for ea49de3
1 file changed
Doc/lib/libuser.tex
@@ -48,12 +48,14 @@ \section{\module{user} ---
48
49
\begin{verbatim}
50
import user
51
-try:
52
- verbose = user.spam_verbose # user's verbosity preference
53
-except AttributeError:
54
- verbose = 0 # default verbosity
+
+verbose = bool(getattr(user, "spam_verbose", 0))
55
\end{verbatim}
56
+(The three-argument form of \function{getattr()} is used in case
+the user has not defined \code{spam_verbose} in their
57
+\file{.pythonrc.py} file.)
58
59
Programs with extensive customization needs are better off reading a
60
program-specific customization file.
61
0 commit comments