Commit 61c7728c authored by Fred Drake's avatar Fred Drake

Make sure all chapters, sections, and subsections have a \label to give them

semantic file names in the HTML.  No more node#.html files!
parent 020f8c01
\chapter{Introduction} \chapter{Introduction\label{introduction}}
This reference manual describes the Python programming language. This reference manual describes the Python programming language.
It is not intended as a tutorial. It is not intended as a tutorial.
...@@ -29,11 +29,11 @@ text. ...@@ -29,11 +29,11 @@ text.
Every Python implementation comes with a number of built-in and Every Python implementation comes with a number of built-in and
standard modules. These are not documented here, but in the separate standard modules. These are not documented here, but in the separate
{\em Python Library Reference} document. A few built-in modules are \emph{Python Library Reference} document. A few built-in modules are
mentioned when they interact in a significant way with the language mentioned when they interact in a significant way with the language
definition. definition.
\section{Notation} \section{Notation\label{notation}}
The descriptions of lexical analysis and syntax use a modified BNF The descriptions of lexical analysis and syntax use a modified BNF
grammar notation. This uses the following style of definition: grammar notation. This uses the following style of definition:
......
...@@ -28,12 +28,12 @@ though the current implementation appears to favor Latin-1. This ...@@ -28,12 +28,12 @@ though the current implementation appears to favor Latin-1. This
applies both to the source character set and the run-time character applies both to the source character set and the run-time character
set. set.
\section{Line structure} \section{Line structure\label{line-structure}}
A Python program is divided into a number of \emph{logical lines}. A Python program is divided into a number of \emph{logical lines}.
\index{line structure} \index{line structure}
\subsection{Logical lines} \subsection{Logical lines\label{logical}}
The end of The end of
a logical line is represented by the token NEWLINE. Statements cannot a logical line is represented by the token NEWLINE. Statements cannot
...@@ -46,7 +46,7 @@ by following the explicit or implicit \emph{line joining} rules. ...@@ -46,7 +46,7 @@ by following the explicit or implicit \emph{line joining} rules.
\index{line joining} \index{line joining}
\index{NEWLINE token} \index{NEWLINE token}
\subsection{Physical lines} \subsection{Physical lines\label{physical}}
A physical line ends in whatever the current platform's convention is A physical line ends in whatever the current platform's convention is
for terminating lines. On \UNIX{}, this is the \ASCII{} LF (linefeed) for terminating lines. On \UNIX{}, this is the \ASCII{} LF (linefeed)
...@@ -54,7 +54,7 @@ character. On DOS/Windows, it is the \ASCII{} sequence CR LF (return ...@@ -54,7 +54,7 @@ character. On DOS/Windows, it is the \ASCII{} sequence CR LF (return
followed by linefeed). On Macintosh, it is the \ASCII{} CR (return) followed by linefeed). On Macintosh, it is the \ASCII{} CR (return)
character. character.
\subsection{Comments} \subsection{Comments\label{comments}}
A comment starts with a hash character (\code{\#}) that is not part of A comment starts with a hash character (\code{\#}) that is not part of
a string literal, and ends at the end of the physical line. A comment a string literal, and ends at the end of the physical line. A comment
...@@ -64,7 +64,7 @@ Comments are ignored by the syntax; they are not tokens. ...@@ -64,7 +64,7 @@ Comments are ignored by the syntax; they are not tokens.
\index{comment} \index{comment}
\index{hash character} \index{hash character}
\subsection{Explicit line joining} \subsection{Explicit line joining\label{explicit-joining}}
Two or more physical lines may be joined into logical lines using Two or more physical lines may be joined into logical lines using
backslash characters (\code{\e}), as follows: when a physical line ends backslash characters (\code{\e}), as follows: when a physical line ends
...@@ -89,7 +89,7 @@ for string literals (i.e., tokens other than string literals cannot be ...@@ -89,7 +89,7 @@ for string literals (i.e., tokens other than string literals cannot be
split across physical lines using a backslash). A backslash is split across physical lines using a backslash). A backslash is
illegal elsewhere on a line outside a string literal. illegal elsewhere on a line outside a string literal.
\subsection{Implicit line joining} \subsection{Implicit line joining\label{implicit-joining}}
Expressions in parentheses, square brackets or curly braces can be Expressions in parentheses, square brackets or curly braces can be
split over more than one physical line without using backslashes. split over more than one physical line without using backslashes.
...@@ -108,7 +108,7 @@ allowed. There is no NEWLINE token between implicit continuation ...@@ -108,7 +108,7 @@ allowed. There is no NEWLINE token between implicit continuation
lines. Implicitly continued lines can also occur within triple-quoted lines. Implicitly continued lines can also occur within triple-quoted
strings (see below); in that case they cannot carry comments. strings (see below); in that case they cannot carry comments.
\subsection{Blank lines} \subsection{Blank lines\label{blank-lines}}
A logical line that contains only spaces, tabs, formfeeds and possibly a A logical line that contains only spaces, tabs, formfeeds and possibly a
comment, is ignored (i.e., no NEWLINE token is generated), except that comment, is ignored (i.e., no NEWLINE token is generated), except that
...@@ -117,7 +117,7 @@ during interactive input of statements, an entirely blank logical line ...@@ -117,7 +117,7 @@ during interactive input of statements, an entirely blank logical line
terminates a multi-line statement. terminates a multi-line statement.
\index{blank line} \index{blank line}
\subsection{Indentation} \subsection{Indentation\label{indentation}}
Leading whitespace (spaces and tabs) at the beginning of a logical Leading whitespace (spaces and tabs) at the beginning of a logical
line is used to compute the indentation level of the line, which in line is used to compute the indentation level of the line, which in
...@@ -199,7 +199,7 @@ The following example shows various indentation errors: ...@@ -199,7 +199,7 @@ The following example shows various indentation errors:
last error is found by the lexical analyzer --- the indentation of last error is found by the lexical analyzer --- the indentation of
\code{return r} does not match a level popped off the stack.) \code{return r} does not match a level popped off the stack.)
\subsection{Whitespace between tokens} \subsection{Whitespace between tokens\label{whitespace}}
Except at the beginning of a logical line or in string literals, the Except at the beginning of a logical line or in string literals, the
whitespace characters space, tab and formfeed can be used whitespace characters space, tab and formfeed can be used
...@@ -207,7 +207,7 @@ interchangeably to separate tokens. Whitespace is needed between two ...@@ -207,7 +207,7 @@ interchangeably to separate tokens. Whitespace is needed between two
tokens only if their concatenation could otherwise be interpreted as a tokens only if their concatenation could otherwise be interpreted as a
different token (e.g., ab is one token, but a b is two tokens). different token (e.g., ab is one token, but a b is two tokens).
\section{Other tokens} \section{Other tokens\label{other-tokens}}
Besides NEWLINE, INDENT and DEDENT, the following categories of tokens Besides NEWLINE, INDENT and DEDENT, the following categories of tokens
exist: \emph{identifiers}, \emph{keywords}, \emph{literals}, exist: \emph{identifiers}, \emph{keywords}, \emph{literals},
...@@ -218,7 +218,7 @@ Where ...@@ -218,7 +218,7 @@ Where
ambiguity exists, a token comprises the longest possible string that ambiguity exists, a token comprises the longest possible string that
forms a legal token, when read from left to right. forms a legal token, when read from left to right.
\section{Identifiers and keywords} \section{Identifiers and keywords\label{identifiers}}
Identifiers (also referred to as \emph{names}) are described by the following Identifiers (also referred to as \emph{names}) are described by the following
lexical definitions: lexical definitions:
...@@ -235,7 +235,7 @@ digit: "0"..."9" ...@@ -235,7 +235,7 @@ digit: "0"..."9"
Identifiers are unlimited in length. Case is significant. Identifiers are unlimited in length. Case is significant.
\subsection{Keywords} \subsection{Keywords\label{keywords}}
The following identifiers are used as reserved words, or The following identifiers are used as reserved words, or
\emph{keywords} of the language, and cannot be used as ordinary \emph{keywords} of the language, and cannot be used as ordinary
...@@ -254,7 +254,7 @@ def finally in print ...@@ -254,7 +254,7 @@ def finally in print
% When adding keywords, use reswords.py for reformatting % When adding keywords, use reswords.py for reformatting
\subsection{Reserved classes of identifiers} \subsection{Reserved classes of identifiers\label{id-classes}}
Certain classes of identifiers (besides keywords) have special Certain classes of identifiers (besides keywords) have special
meanings. These are: meanings. These are:
...@@ -267,13 +267,13 @@ meanings. These are: ...@@ -267,13 +267,13 @@ meanings. These are:
(XXX need section references here.) (XXX need section references here.)
\section{Literals} \label{literals} \section{Literals\label{literals}}
Literals are notations for constant values of some built-in types. Literals are notations for constant values of some built-in types.
\index{literal} \index{literal}
\index{constant} \index{constant}
\subsection{String literals} \subsection{String literals\label{strings}}
String literals are described by the following lexical definitions: String literals are described by the following lexical definitions:
\index{string literal} \index{string literal}
...@@ -357,7 +357,7 @@ backslashes). Specifically, \emph{a raw string cannot end in a single ...@@ -357,7 +357,7 @@ backslashes). Specifically, \emph{a raw string cannot end in a single
backslash} (since the backslash would escape the following quote backslash} (since the backslash would escape the following quote
character). character).
\subsection{String literal concatenation} \subsection{String literal concatenation\label{string-catenation}}
Multiple adjacent string literals (delimited by whitespace), possibly Multiple adjacent string literals (delimited by whitespace), possibly
using different quoting conventions, are allowed, and their meaning is using different quoting conventions, are allowed, and their meaning is
...@@ -379,7 +379,7 @@ concatenate string expressions at run time. Also note that literal ...@@ -379,7 +379,7 @@ concatenate string expressions at run time. Also note that literal
concatenation can use different quoting styles for each component concatenation can use different quoting styles for each component
(even mixing raw strings and triple quoted strings). (even mixing raw strings and triple quoted strings).
\subsection{Numeric literals} \subsection{Numeric literals\label{numbers}}
There are four types of numeric literals: plain integers, long There are four types of numeric literals: plain integers, long
integers, floating point numbers, and imaginary numbers. There are no integers, floating point numbers, and imaginary numbers. There are no
...@@ -401,7 +401,7 @@ Note that numeric literals do not include a sign; a phrase like ...@@ -401,7 +401,7 @@ Note that numeric literals do not include a sign; a phrase like
\code{-1} is actually an expression composed of the unary operator \code{-1} is actually an expression composed of the unary operator
`\code{-}' and the literal \code{1}. `\code{-}' and the literal \code{1}.
\subsection{Integer and long integer literals} \subsection{Integer and long integer literals\label{integers}}
Integer and long integer literals are described by the following Integer and long integer literals are described by the following
lexical definitions: lexical definitions:
...@@ -435,7 +435,7 @@ Some examples of plain and long integer literals: ...@@ -435,7 +435,7 @@ Some examples of plain and long integer literals:
3L 79228162514264337593543950336L 0377L 0x100000000L 3L 79228162514264337593543950336L 0377L 0x100000000L
\end{verbatim} \end{verbatim}
\subsection{Floating point literals} \subsection{Floating point literals\label{floating}}
Floating point literals are described by the following lexical Floating point literals are described by the following lexical
definitions: definitions:
...@@ -463,7 +463,7 @@ Note that numeric literals do not include a sign; a phrase like ...@@ -463,7 +463,7 @@ Note that numeric literals do not include a sign; a phrase like
\code{-1} is actually an expression composed of the operator \code{-1} is actually an expression composed of the operator
\code{-} and the literal \code{1}. \code{-} and the literal \code{1}.
\subsection{Imaginary literals} \subsection{Imaginary literals\label{imaginary}}
Imaginary literals are described by the following lexical definitions: Imaginary literals are described by the following lexical definitions:
...@@ -482,7 +482,7 @@ to it, e.g., \code{(3+4j)}. Some examples of imaginary literals: ...@@ -482,7 +482,7 @@ to it, e.g., \code{(3+4j)}. Some examples of imaginary literals:
\end{verbatim} \end{verbatim}
\section{Operators} \section{Operators\label{operators}}
The following tokens are operators: The following tokens are operators:
\index{operators} \index{operators}
...@@ -497,7 +497,7 @@ The comparison operators \code{<>} and \code{!=} are alternate ...@@ -497,7 +497,7 @@ The comparison operators \code{<>} and \code{!=} are alternate
spellings of the same operator. \code{!=} is the preferred spelling; spellings of the same operator. \code{!=} is the preferred spelling;
\code{<>} is obsolescent. \code{<>} is obsolescent.
\section{Delimiters} \section{Delimiters\label{delimiters}}
The following tokens serve as delimiters in the grammar: The following tokens serve as delimiters in the grammar:
\index{delimiters} \index{delimiters}
......
\chapter{Data model} \chapter{Data model\label{datamodel}}
\section{Objects, values and types} \section{Objects, values and types\label{objects}}
\dfn{Objects} are Python's abstraction for data. All data in a Python \dfn{Objects} are Python's abstraction for data. All data in a Python
program is represented by objects or by relations between objects. program is represented by objects or by relations between objects.
...@@ -87,7 +87,7 @@ lists. ...@@ -87,7 +87,7 @@ lists.
(Note that ``\code{c = d = []}'' assigns the same object to both (Note that ``\code{c = d = []}'' assigns the same object to both
\code{c} and \code{d}.) \code{c} and \code{d}.)
\section{The standard type hierarchy} \label{types} \section{The standard type hierarchy\label{types}}
Below is a list of the types that are built into Python. Extension Below is a list of the types that are built into Python. Extension
modules written in \C{} can define additional types. Future versions of modules written in \C{} can define additional types. Future versions of
...@@ -781,7 +781,7 @@ Special read-only attributes: \code{start} is the lowerbound; ...@@ -781,7 +781,7 @@ Special read-only attributes: \code{start} is the lowerbound;
\end{description} % Types \end{description} % Types
\section{Special method names} \label{specialnames} \section{Special method names\label{specialnames}}
A class can implement certain operations that are invoked by special A class can implement certain operations that are invoked by special
syntax (such as arithmetic operations or subscripting and slicing) by defining syntax (such as arithmetic operations or subscripting and slicing) by defining
...@@ -795,7 +795,7 @@ operation raise an exception when no appropriate method is defined. ...@@ -795,7 +795,7 @@ operation raise an exception when no appropriate method is defined.
\ttindex{__getitem__} \ttindex{__getitem__}
\subsection{Basic customization} \subsection{Basic customization\label{customization}}
\begin{description} \begin{description}
...@@ -917,7 +917,7 @@ this method is not defined, \code{__len__} is called, if it is defined ...@@ -917,7 +917,7 @@ this method is not defined, \code{__len__} is called, if it is defined
\end{description} \end{description}
\subsection{Customizing attribute access} \subsection{Customizing attribute access\label{attribute-access}}
The following methods can be defined to customize the meaning of The following methods can be defined to customize the meaning of
attribute access (use of, assignment to, or deletion of \code{x.name}) attribute access (use of, assignment to, or deletion of \code{x.name})
...@@ -969,7 +969,7 @@ assignment. ...@@ -969,7 +969,7 @@ assignment.
\end{description} \end{description}
\subsection{Emulating callable objects} \subsection{Emulating callable objects\label{callable-types}}
\begin{description} \begin{description}
...@@ -983,7 +983,7 @@ is defined, \code{x(arg1, arg2, ...)} is a shorthand for ...@@ -983,7 +983,7 @@ is defined, \code{x(arg1, arg2, ...)} is a shorthand for
\end{description} \end{description}
\subsection{Emulating sequence and mapping types} \subsection{Emulating sequence and mapping types\label{sequence-types}}
The following methods can be defined to emulate sequence or mapping The following methods can be defined to emulate sequence or mapping
objects. The first set of methods is used either to emulate a objects. The first set of methods is used either to emulate a
...@@ -1057,7 +1057,8 @@ Called to implement deletion of \code{self[key]}. Same note as for ...@@ -1057,7 +1057,8 @@ Called to implement deletion of \code{self[key]}. Same note as for
\end{description} \end{description}
\subsection{Additional methods for emulation of sequence types} \subsection{Additional methods for emulation of sequence types%
\label{sequence-methods}}
The following methods can be defined to further emulate sequence The following methods can be defined to further emulate sequence
objects. Immutable sequences methods should only define objects. Immutable sequences methods should only define
...@@ -1092,7 +1093,7 @@ single colon is used. For slice operations involving extended slice ...@@ -1092,7 +1093,7 @@ single colon is used. For slice operations involving extended slice
notation, \method{__getitem__()}, \method{__setitem__()} notation, \method{__getitem__()}, \method{__setitem__()}
or\method{__delitem__()} is called. or\method{__delitem__()} is called.
\subsection{Emulating numeric types} \subsection{Emulating numeric types\label{numeric-types}}
The following methods can be defined to emulate numeric objects. The following methods can be defined to emulate numeric objects.
Methods corresponding to operations that are not supported by the Methods corresponding to operations that are not supported by the
......
\chapter{Execution model\label{execmodel}} \chapter{Execution model\label{execmodel}}
\index{execution model} \index{execution model}
\section{Code blocks, execution frames, and namespaces} \label{execframes} \section{Code blocks, execution frames, and namespaces\label{execframes}}
\index{code block} \index{code block}
\indexii{execution}{frame} \indexii{execution}{frame}
\index{namespace} \index{namespace}
...@@ -165,7 +165,7 @@ used to implement the namespace, \emph{except} for functions, where ...@@ -165,7 +165,7 @@ used to implement the namespace, \emph{except} for functions, where
the optimizer may cause the local namespace to be implemented the optimizer may cause the local namespace to be implemented
differently, and \function{locals()} returns a read-only dictionary.} differently, and \function{locals()} returns a read-only dictionary.}
\section{Exceptions} \section{Exceptions\label{exceptions}}
Exceptions are a means of breaking out of the normal flow of control Exceptions are a means of breaking out of the normal flow of control
of a code block in order to handle errors or other exceptional of a code block in order to handle errors or other exceptional
......
\chapter{Simple statements} \chapter{Simple statements\label{simple}}
\indexii{simple}{statement} \indexii{simple}{statement}
Simple statements are comprised within a single logical line. Simple statements are comprised within a single logical line.
...@@ -21,7 +21,7 @@ simple_stmt: expression_stmt ...@@ -21,7 +21,7 @@ simple_stmt: expression_stmt
| exec_stmt | exec_stmt
\end{verbatim} \end{verbatim}
\section{Expression statements} \section{Expression statements\label{exprstmts}}
\indexii{expression}{statement} \indexii{expression}{statement}
Expression statements are used (mostly interactively) to compute and Expression statements are used (mostly interactively) to compute and
...@@ -51,7 +51,7 @@ any output.) ...@@ -51,7 +51,7 @@ any output.)
\indexii{writing}{values} \indexii{writing}{values}
\indexii{procedure}{call} \indexii{procedure}{call}
\section{Assert statements}\stindex{assert} \section{Assert statements\label{assert}}\stindex{assert}
Assert statements are a convenient way to insert debugging Assert statements are a convenient way to insert debugging
assertions\indexii{debugging}{assertions} into a program: assertions\indexii{debugging}{assertions} into a program:
...@@ -86,7 +86,7 @@ the source code for the expression that failed in the error message; ...@@ -86,7 +86,7 @@ the source code for the expression that failed in the error message;
it will be displayed as part of the stack trace. it will be displayed as part of the stack trace.
\section{Assignment statements} \section{Assignment statements\label{assignment}}
\indexii{assignment}{statement} \indexii{assignment}{statement}
Assignment statements are used to (re)bind names to values and to Assignment statements are used to (re)bind names to values and to
...@@ -247,7 +247,7 @@ print x ...@@ -247,7 +247,7 @@ print x
\end{verbatim} \end{verbatim}
\section{The \keyword{pass} statement} \section{The \keyword{pass} statement\label{pass}}
\stindex{pass} \stindex{pass}
\begin{verbatim} \begin{verbatim}
...@@ -265,7 +265,7 @@ def f(arg): pass # a function that does nothing (yet) ...@@ -265,7 +265,7 @@ def f(arg): pass # a function that does nothing (yet)
class C: pass # a class with no methods (yet) class C: pass # a class with no methods (yet)
\end{verbatim} \end{verbatim}
\section{The \keyword{del} statement} \section{The \keyword{del} statement\label{del}}
\stindex{del} \stindex{del}
\begin{verbatim} \begin{verbatim}
...@@ -293,7 +293,7 @@ is in general equivalent to assignment of an empty slice of the ...@@ -293,7 +293,7 @@ is in general equivalent to assignment of an empty slice of the
right type (but even this is determined by the sliced object). right type (but even this is determined by the sliced object).
\indexii{attribute}{deletion} \indexii{attribute}{deletion}
\section{The \keyword{print} statement} \label{print} \section{The \keyword{print} statement\label{print}}
\stindex{print} \stindex{print}
\begin{verbatim} \begin{verbatim}
...@@ -330,7 +330,7 @@ exception is raised. ...@@ -330,7 +330,7 @@ exception is raised.
\ttindex{stdout} \ttindex{stdout}
\exindex{RuntimeError} \exindex{RuntimeError}
\section{The \keyword{return} statement} \section{The \keyword{return} statement\label{return}}
\stindex{return} \stindex{return}
\begin{verbatim} \begin{verbatim}
...@@ -353,7 +353,7 @@ with a \keyword{finally} clause, that \keyword{finally} clause is executed ...@@ -353,7 +353,7 @@ with a \keyword{finally} clause, that \keyword{finally} clause is executed
before really leaving the function. before really leaving the function.
\kwindex{finally} \kwindex{finally}
\section{The \keyword{raise} statement} \section{The \keyword{raise} statement\label{raise}}
\stindex{raise} \stindex{raise}
\begin{verbatim} \begin{verbatim}
...@@ -387,7 +387,7 @@ exception occurred. This is useful to re-raise an exception ...@@ -387,7 +387,7 @@ exception occurred. This is useful to re-raise an exception
transparently in an except clause. transparently in an except clause.
\obindex{traceback} \obindex{traceback}
\section{The \keyword{break} statement} \section{The \keyword{break} statement\label{break}}
\stindex{break} \stindex{break}
\begin{verbatim} \begin{verbatim}
...@@ -414,7 +414,7 @@ with a \keyword{finally} clause, that \keyword{finally} clause is executed ...@@ -414,7 +414,7 @@ with a \keyword{finally} clause, that \keyword{finally} clause is executed
before really leaving the loop. before really leaving the loop.
\kwindex{finally} \kwindex{finally}
\section{The \keyword{continue} statement} \section{The \keyword{continue} statement\label{continue}}
\stindex{continue} \stindex{continue}
\begin{verbatim} \begin{verbatim}
...@@ -433,7 +433,7 @@ It continues with the next cycle of the nearest enclosing loop. ...@@ -433,7 +433,7 @@ It continues with the next cycle of the nearest enclosing loop.
\indexii{loop}{statement} \indexii{loop}{statement}
\kwindex{finally} \kwindex{finally}
\section{The \keyword{import} statement} \label{import} \section{The \keyword{import} statement\label{import}}
\stindex{import} \stindex{import}
\begin{verbatim} \begin{verbatim}
...@@ -527,7 +527,7 @@ about how the module search works from inside a package.] ...@@ -527,7 +527,7 @@ about how the module search works from inside a package.]
[XXX Also should mention __import__().] [XXX Also should mention __import__().]
\bifuncindex{__import__} \bifuncindex{__import__}
\section{The \keyword{global} statement} \label{global} \section{The \keyword{global} statement\label{global}}
\stindex{global} \stindex{global}
\begin{verbatim} \begin{verbatim}
...@@ -567,7 +567,7 @@ containing the \keyword{exec} statement. The same applies to the ...@@ -567,7 +567,7 @@ containing the \keyword{exec} statement. The same applies to the
\bifuncindex{execfile} \bifuncindex{execfile}
\bifuncindex{compile} \bifuncindex{compile}
\section{The {\tt exec} statement} \label{exec} \section{The \keyword{exec} statement\label{exec}}
\stindex{exec} \stindex{exec}
\begin{verbatim} \begin{verbatim}
......
\chapter{Compound statements} \chapter{Compound statements\label{compound}}
\indexii{compound}{statement} \indexii{compound}{statement}
Compound statements contain (groups of) other statements; they affect Compound statements contain (groups of) other statements; they affect
...@@ -60,7 +60,7 @@ statement, thus there are no ambiguities (the `dangling ...@@ -60,7 +60,7 @@ statement, thus there are no ambiguities (the `dangling
The formatting of the grammar rules in the following sections places The formatting of the grammar rules in the following sections places
each clause on a separate line for clarity. each clause on a separate line for clarity.
\section{The \keyword{if} statement} \section{The \keyword{if} statement\label{if}}
\stindex{if} \stindex{if}
The \keyword{if} statement is used for conditional execution: The \keyword{if} statement is used for conditional execution:
...@@ -80,7 +80,7 @@ present, is executed. ...@@ -80,7 +80,7 @@ present, is executed.
\kwindex{elif} \kwindex{elif}
\kwindex{else} \kwindex{else}
\section{The \keyword{while} statement} \section{The \keyword{while} statement\label{while}}
\stindex{while} \stindex{while}
\indexii{loop}{statement} \indexii{loop}{statement}
...@@ -105,7 +105,7 @@ of the suite and goes back to testing the expression. ...@@ -105,7 +105,7 @@ of the suite and goes back to testing the expression.
\stindex{break} \stindex{break}
\stindex{continue} \stindex{continue}
\section{The \keyword{for} statement} \section{The \keyword{for} statement\label{for}}
\stindex{for} \stindex{for}
\indexii{loop}{statement} \indexii{loop}{statement}
...@@ -169,7 +169,7 @@ for x in a[:]: ...@@ -169,7 +169,7 @@ for x in a[:]:
if x < 0: a.remove(x) if x < 0: a.remove(x)
\end{verbatim} \end{verbatim}
\section{The \keyword{try} statement} \label{try} \section{The \keyword{try} statement\label{try}}
\stindex{try} \stindex{try}
The \keyword{try} statement specifies exception handlers and/or cleanup The \keyword{try} statement specifies exception handlers and/or cleanup
...@@ -271,7 +271,7 @@ restriction may be lifted in the future). ...@@ -271,7 +271,7 @@ restriction may be lifted in the future).
\stindex{break} \stindex{break}
\stindex{continue} \stindex{continue}
\section{Function definitions} \label{function} \section{Function definitions\label{function}}
\indexii{function}{definition} \indexii{function}{definition}
A function definition defines a user-defined function object (see A function definition defines a user-defined function object (see
...@@ -359,7 +359,7 @@ add1 = make_incrementer(1) ...@@ -359,7 +359,7 @@ add1 = make_incrementer(1)
print add1(3) # This prints '4' print add1(3) # This prints '4'
\end{verbatim} \end{verbatim}
\section{Class definitions} \label{class} \section{Class definitions\label{class}}
\indexii{class}{definition} \indexii{class}{definition}
A class definition defines a class object (see section \ref{types}): A class definition defines a class object (see section \ref{types}):
......
\chapter{Top-level components} \chapter{Top-level components\label{top-level}}
The Python interpreter can get its input from a number of sources: The Python interpreter can get its input from a number of sources:
from a script passed to it as standard input or as program argument, from a script passed to it as standard input or as program argument,
...@@ -6,7 +6,7 @@ typed in interactively, from a module source file, etc. This chapter ...@@ -6,7 +6,7 @@ typed in interactively, from a module source file, etc. This chapter
gives the syntax used in these cases. gives the syntax used in these cases.
\index{interpreter} \index{interpreter}
\section{Complete Python programs} \section{Complete Python programs\label{programs}}
\index{program} \index{program}
While a language specification need not prescribe how the language While a language specification need not prescribe how the language
...@@ -43,7 +43,7 @@ program. ...@@ -43,7 +43,7 @@ program.
\index{command line} \index{command line}
\index{standard input} \index{standard input}
\section{File input} \section{File input\label{file-input}}
All input read from non-interactive files has the same form: All input read from non-interactive files has the same form:
...@@ -63,7 +63,7 @@ This syntax is used in the following situations: ...@@ -63,7 +63,7 @@ This syntax is used in the following situations:
\end{itemize} \end{itemize}
\section{Interactive input} \section{Interactive input\label{interactive}}
Input in interactive mode is parsed using the following grammar: Input in interactive mode is parsed using the following grammar:
...@@ -75,7 +75,7 @@ Note that a (top-level) compound statement must be followed by a blank ...@@ -75,7 +75,7 @@ Note that a (top-level) compound statement must be followed by a blank
line in interactive mode; this is needed to help the parser detect the line in interactive mode; this is needed to help the parser detect the
end of the input. end of the input.
\section{Expression input} \section{Expression input\label{expression-input}}
\index{input} \index{input}
There are two forms of expression input. Both ignore leading There are two forms of expression input. Both ignore leading
......
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