Typo: "Otherwose" --> "Otherwise" (reported by Joakim Sernbrant

<joakim.sernbrant@front.se>).

Misc. small fixes to the logical markup.
This commit is contained in:
Fred Drake 1999-04-14 12:52:14 +00:00
parent 79d41ccdd3
commit 011f6fca31

View file

@ -51,23 +51,23 @@ any output.)
\indexii{writing}{values} \indexii{writing}{values}
\indexii{procedure}{call} \indexii{procedure}{call}
\section{Assert statements\label{assert}}\stindex{assert} \section{Assert statements \label{assert}}
Assert statements are a convenient way to insert debugging Assert statements\stindex{assert} are a convenient way to insert
assertions\indexii{debugging}{assertions} into a program: debugging assertions\indexii{debugging}{assertions} into a program:
\begin{verbatim} \begin{verbatim}
assert_statement: "assert" expression ["," expression] assert_statement: "assert" expression ["," expression]
\end{verbatim} \end{verbatim}
The simple form, ``\code{assert expression}'', is equivalent to The simple form, \samp{assert expression}, is equivalent to
\begin{verbatim} \begin{verbatim}
if __debug__: if __debug__:
if not expression: raise AssertionError if not expression: raise AssertionError
\end{verbatim} \end{verbatim}
The extended form, ``\code{assert expression1, expression2}'', is The extended form, \samp{assert expression1, expression2}, is
equivalent to equivalent to
\begin{verbatim} \begin{verbatim}
@ -76,7 +76,7 @@ if __debug__:
\end{verbatim} \end{verbatim}
These equivalences assume that \code{__debug__}\ttindex{__debug__} and These equivalences assume that \code{__debug__}\ttindex{__debug__} and
\code{AssertionError}\exindex{AssertionError} refer to the built-in \exception{AssertionError}\exindex{AssertionError} refer to the built-in
variables with those names. In the current implementation, the variables with those names. In the current implementation, the
built-in variable \code{__debug__} is 1 under normal circumstances, 0 built-in variable \code{__debug__} is 1 under normal circumstances, 0
when optimization is requested (command line option -O). The current when optimization is requested (command line option -O). The current
@ -87,10 +87,10 @@ it will be displayed as part of the stack trace.
\section{Assignment statements \label{assignment}} \section{Assignment statements \label{assignment}}
\indexii{assignment}{statement}
Assignment statements are used to (re)bind names to values and to Assignment statements\indexii{assignment}{statement} are used to
modify attributes or items of mutable objects: (re)bind names to values and to modify attributes or items of mutable
objects:
\indexii{binding}{name} \indexii{binding}{name}
\indexii{rebinding}{name} \indexii{rebinding}{name}
\obindex{mutable} \obindex{mutable}
@ -137,7 +137,7 @@ must be a sequence with the same number of items as the there are
targets in the target list, and the items are assigned, from left to targets in the target list, and the items are assigned, from left to
right, to the corresponding targets. (This rule is relaxed as of right, to the corresponding targets. (This rule is relaxed as of
Python 1.5; in earlier versions, the object had to be a tuple. Since Python 1.5; in earlier versions, the object had to be a tuple. Since
strings are sequences, an assignment like ``\code{a, b = "xy"}'' is strings are sequences, an assignment like \samp{a, b = "xy"} is
now legal as long as the string has the right length.) now legal as long as the string has the right length.)
\end{itemize} \end{itemize}
@ -235,9 +235,9 @@ messages.)
WARNING: Although the definition of assignment implies that overlaps WARNING: Although the definition of assignment implies that overlaps
between the left-hand side and the right-hand side are `safe' (e.g., between the left-hand side and the right-hand side are `safe' (e.g.,
``\code{a, b = b, a}'' swaps two variables), overlaps \emph{within} the \samp{a, b = b, a} swaps two variables), overlaps \emph{within} the
collection of assigned-to variables are not safe! For instance, the collection of assigned-to variables are not safe! For instance, the
following program prints ``\code{[0, 2]}'': following program prints \samp{[0, 2]}:
\begin{verbatim} \begin{verbatim}
x = [0, 1] x = [0, 1]
@ -363,7 +363,7 @@ raise_stmt: "raise" [expression ["," expression ["," expression]]]
If no expressions are present, \keyword{raise} re-raises the last If no expressions are present, \keyword{raise} re-raises the last
expression that was raised in the current scope. expression that was raised in the current scope.
Otherwose, \keyword{raise} evaluates its first expression, which must yield Otherwise, \keyword{raise} evaluates its first expression, which must yield
a string, class, or instance object. If there is a second expression, a string, class, or instance object. If there is a second expression,
this is evaluated, else \code{None} is substituted. If the first this is evaluated, else \code{None} is substituted. If the first
expression is a class object, then the second expression may be an expression is a class object, then the second expression may be an
@ -501,8 +501,8 @@ module name: it goes through the list of identifiers, looks each one
of them up in the module found in step (1), and binds the name in the of them up in the module found in step (1), and binds the name in the
local namespace to the object thus found. If a name is not found, local namespace to the object thus found. If a name is not found,
\exception{ImportError} is raised. If the list of identifiers is replaced \exception{ImportError} is raised. If the list of identifiers is replaced
by a star (\code{*}), all names defined in the module are bound, by a star (\samp{*}), all names defined in the module are bound,
except those beginning with an underscore(\code{_}). except those beginning with an underscore (\character{_}).
\indexii{name}{binding} \indexii{name}{binding}
\exindex{ImportError} \exindex{ImportError}
@ -510,7 +510,7 @@ Names bound by \keyword{import} statements may not occur in
\keyword{global} statements in the same scope. \keyword{global} statements in the same scope.
\stindex{global} \stindex{global}
The \keyword{from} form with \code{*} may only occur in a module scope. The \keyword{from} form with \samp{*} may only occur in a module scope.
\kwindex{from} \kwindex{from}
\stindex{from} \stindex{from}