diff options
Diffstat (limited to 'Doc/lib/libni.tex')
-rw-r--r-- | Doc/lib/libni.tex | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/Doc/lib/libni.tex b/Doc/lib/libni.tex index 219f081..8a251da 100644 --- a/Doc/lib/libni.tex +++ b/Doc/lib/libni.tex @@ -28,20 +28,20 @@ To import module \code{ham} from package \code{spam} and use function \code{hamneggs()} from that module, you can use any of the following possibilities: -\bcode\begin{verbatim} +\begin{verbatim} import spam.ham # *not* "import spam" !!! spam.ham.hamneggs() -\end{verbatim}\ecode +\end{verbatim} % -\bcode\begin{verbatim} +\begin{verbatim} from spam import ham ham.hamneggs() -\end{verbatim}\ecode +\end{verbatim} % -\bcode\begin{verbatim} +\begin{verbatim} from spam.ham import hamneggs hamneggs() -\end{verbatim}\ecode +\end{verbatim} % \code{import spam} creates an empty package named \code{spam} if one does not already exist, but it does @@ -52,9 +52,9 @@ The only submodule that is guaranteed to be imported is \code{spam.__init__} is a submodule of package spam. It can refer to spam's namespace as \code{__} (two underscores): -\bcode\begin{verbatim} +\begin{verbatim} __.spam_inited = 1 # Set a package-level variable -\end{verbatim}\ecode +\end{verbatim} % Additional initialization code (setting up variables, importing other submodules) can be performed in \file{spam/__init__.py}. |