diff options
-rw-r--r-- | Doc/ref/ref1.tex | 6 | ||||
-rw-r--r-- | Doc/ref/ref2.tex | 44 | ||||
-rw-r--r-- | Doc/ref/ref3.tex | 21 | ||||
-rw-r--r-- | Doc/ref/ref4.tex | 4 | ||||
-rw-r--r-- | Doc/ref/ref6.tex | 28 | ||||
-rw-r--r-- | Doc/ref/ref7.tex | 14 | ||||
-rw-r--r-- | Doc/ref/ref8.tex | 10 |
7 files changed, 64 insertions, 63 deletions
diff --git a/Doc/ref/ref1.tex b/Doc/ref/ref1.tex index e821eea..23bc05d 100644 --- a/Doc/ref/ref1.tex +++ b/Doc/ref/ref1.tex @@ -1,4 +1,4 @@ -\chapter{Introduction} +\chapter{Introduction\label{introduction}} This reference manual describes the Python programming language. It is not intended as a tutorial. @@ -29,11 +29,11 @@ text. Every Python implementation comes with a number of built-in and 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 definition. -\section{Notation} +\section{Notation\label{notation}} The descriptions of lexical analysis and syntax use a modified BNF grammar notation. This uses the following style of definition: diff --git a/Doc/ref/ref2.tex b/Doc/ref/ref2.tex index acced61..e187c7a 100644 --- a/Doc/ref/ref2.tex +++ b/Doc/ref/ref2.tex @@ -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 set. -\section{Line structure} +\section{Line structure\label{line-structure}} A Python program is divided into a number of \emph{logical lines}. \index{line structure} -\subsection{Logical lines} +\subsection{Logical lines\label{logical}} The end of 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. \index{line joining} \index{NEWLINE token} -\subsection{Physical lines} +\subsection{Physical lines\label{physical}} A physical line ends in whatever the current platform's convention is 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 followed by linefeed). On Macintosh, it is the \ASCII{} CR (return) character. -\subsection{Comments} +\subsection{Comments\label{comments}} 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 @@ -64,7 +64,7 @@ Comments are ignored by the syntax; they are not tokens. \index{comment} \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 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 split across physical lines using a backslash). A backslash is 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 split over more than one physical line without using backslashes. @@ -108,7 +108,7 @@ allowed. There is no NEWLINE token between implicit continuation lines. Implicitly continued lines can also occur within triple-quoted 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 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 terminates a multi-line statement. \index{blank line} -\subsection{Indentation} +\subsection{Indentation\label{indentation}} Leading whitespace (spaces and tabs) at the beginning of a logical line is used to compute the indentation level of the line, which in @@ -199,7 +199,7 @@ The following example shows various indentation errors: last error is found by the lexical analyzer --- the indentation of \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 whitespace characters space, tab and formfeed can be used @@ -207,7 +207,7 @@ interchangeably to separate tokens. Whitespace is needed between two 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). -\section{Other tokens} +\section{Other tokens\label{other-tokens}} Besides NEWLINE, INDENT and DEDENT, the following categories of tokens exist: \emph{identifiers}, \emph{keywords}, \emph{literals}, @@ -218,7 +218,7 @@ Where ambiguity exists, a token comprises the longest possible string that 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 lexical definitions: @@ -235,7 +235,7 @@ digit: "0"..."9" Identifiers are unlimited in length. Case is significant. -\subsection{Keywords} +\subsection{Keywords\label{keywords}} The following identifiers are used as reserved words, or \emph{keywords} of the language, and cannot be used as ordinary @@ -254,7 +254,7 @@ def finally in print % 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 meanings. These are: @@ -267,13 +267,13 @@ meanings. These are: (XXX need section references here.) -\section{Literals} \label{literals} +\section{Literals\label{literals}} Literals are notations for constant values of some built-in types. \index{literal} \index{constant} -\subsection{String literals} +\subsection{String literals\label{strings}} String literals are described by the following lexical definitions: \index{string literal} @@ -357,7 +357,7 @@ backslashes). Specifically, \emph{a raw string cannot end in a single backslash} (since the backslash would escape the following quote character). -\subsection{String literal concatenation} +\subsection{String literal concatenation\label{string-catenation}} Multiple adjacent string literals (delimited by whitespace), possibly using different quoting conventions, are allowed, and their meaning is @@ -379,7 +379,7 @@ concatenate string expressions at run time. Also note that literal concatenation can use different quoting styles for each component (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 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 \code{-1} is actually an expression composed of the unary operator `\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 lexical definitions: @@ -435,7 +435,7 @@ Some examples of plain and long integer literals: 3L 79228162514264337593543950336L 0377L 0x100000000L \end{verbatim} -\subsection{Floating point literals} +\subsection{Floating point literals\label{floating}} Floating point literals are described by the following lexical definitions: @@ -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{-} and the literal \code{1}. -\subsection{Imaginary literals} +\subsection{Imaginary literals\label{imaginary}} 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: \end{verbatim} -\section{Operators} +\section{Operators\label{operators}} The following tokens are operators: \index{operators} @@ -497,7 +497,7 @@ The comparison operators \code{<>} and \code{!=} are alternate spellings of the same operator. \code{!=} is the preferred spelling; \code{<>} is obsolescent. -\section{Delimiters} +\section{Delimiters\label{delimiters}} The following tokens serve as delimiters in the grammar: \index{delimiters} diff --git a/Doc/ref/ref3.tex b/Doc/ref/ref3.tex index 037191e..91ce104 100644 --- a/Doc/ref/ref3.tex +++ b/Doc/ref/ref3.tex @@ -1,6 +1,6 @@ -\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 program is represented by objects or by relations between objects. @@ -87,7 +87,7 @@ lists. (Note that ``\code{c = d = []}'' assigns the same object to both \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 modules written in \C{} can define additional types. Future versions of @@ -781,7 +781,7 @@ Special read-only attributes: \code{start} is the lowerbound; \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 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. \ttindex{__getitem__} -\subsection{Basic customization} +\subsection{Basic customization\label{customization}} \begin{description} @@ -917,7 +917,7 @@ this method is not defined, \code{__len__} is called, if it is defined \end{description} -\subsection{Customizing attribute access} +\subsection{Customizing attribute access\label{attribute-access}} The following methods can be defined to customize the meaning of attribute access (use of, assignment to, or deletion of \code{x.name}) @@ -969,7 +969,7 @@ assignment. \end{description} -\subsection{Emulating callable objects} +\subsection{Emulating callable objects\label{callable-types}} \begin{description} @@ -983,7 +983,7 @@ is defined, \code{x(arg1, arg2, ...)} is a shorthand for \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 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 \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 objects. Immutable sequences methods should only define @@ -1092,7 +1093,7 @@ single colon is used. For slice operations involving extended slice notation, \method{__getitem__()}, \method{__setitem__()} 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. Methods corresponding to operations that are not supported by the diff --git a/Doc/ref/ref4.tex b/Doc/ref/ref4.tex index aace01f..b5ed417 100644 --- a/Doc/ref/ref4.tex +++ b/Doc/ref/ref4.tex @@ -1,7 +1,7 @@ \chapter{Execution model\label{execmodel}} \index{execution model} -\section{Code blocks, execution frames, and namespaces} \label{execframes} +\section{Code blocks, execution frames, and namespaces\label{execframes}} \index{code block} \indexii{execution}{frame} \index{namespace} @@ -165,7 +165,7 @@ used to implement the namespace, \emph{except} for functions, where the optimizer may cause the local namespace to be implemented 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 of a code block in order to handle errors or other exceptional diff --git a/Doc/ref/ref6.tex b/Doc/ref/ref6.tex index 9e2f65e..1c0e1eb 100644 --- a/Doc/ref/ref6.tex +++ b/Doc/ref/ref6.tex @@ -1,4 +1,4 @@ -\chapter{Simple statements} +\chapter{Simple statements\label{simple}} \indexii{simple}{statement} Simple statements are comprised within a single logical line. @@ -21,7 +21,7 @@ simple_stmt: expression_stmt | exec_stmt \end{verbatim} -\section{Expression statements} +\section{Expression statements\label{exprstmts}} \indexii{expression}{statement} Expression statements are used (mostly interactively) to compute and @@ -51,7 +51,7 @@ any output.) \indexii{writing}{values} \indexii{procedure}{call} -\section{Assert statements}\stindex{assert} +\section{Assert statements\label{assert}}\stindex{assert} Assert statements are a convenient way to insert debugging assertions\indexii{debugging}{assertions} into a program: @@ -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. -\section{Assignment statements} +\section{Assignment statements\label{assignment}} \indexii{assignment}{statement} Assignment statements are used to (re)bind names to values and to @@ -247,7 +247,7 @@ print x \end{verbatim} -\section{The \keyword{pass} statement} +\section{The \keyword{pass} statement\label{pass}} \stindex{pass} \begin{verbatim} @@ -265,7 +265,7 @@ def f(arg): pass # a function that does nothing (yet) class C: pass # a class with no methods (yet) \end{verbatim} -\section{The \keyword{del} statement} +\section{The \keyword{del} statement\label{del}} \stindex{del} \begin{verbatim} @@ -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). \indexii{attribute}{deletion} -\section{The \keyword{print} statement} \label{print} +\section{The \keyword{print} statement\label{print}} \stindex{print} \begin{verbatim} @@ -330,7 +330,7 @@ exception is raised. \ttindex{stdout} \exindex{RuntimeError} -\section{The \keyword{return} statement} +\section{The \keyword{return} statement\label{return}} \stindex{return} \begin{verbatim} @@ -353,7 +353,7 @@ with a \keyword{finally} clause, that \keyword{finally} clause is executed before really leaving the function. \kwindex{finally} -\section{The \keyword{raise} statement} +\section{The \keyword{raise} statement\label{raise}} \stindex{raise} \begin{verbatim} @@ -387,7 +387,7 @@ exception occurred. This is useful to re-raise an exception transparently in an except clause. \obindex{traceback} -\section{The \keyword{break} statement} +\section{The \keyword{break} statement\label{break}} \stindex{break} \begin{verbatim} @@ -414,7 +414,7 @@ with a \keyword{finally} clause, that \keyword{finally} clause is executed before really leaving the loop. \kwindex{finally} -\section{The \keyword{continue} statement} +\section{The \keyword{continue} statement\label{continue}} \stindex{continue} \begin{verbatim} @@ -433,7 +433,7 @@ It continues with the next cycle of the nearest enclosing loop. \indexii{loop}{statement} \kwindex{finally} -\section{The \keyword{import} statement} \label{import} +\section{The \keyword{import} statement\label{import}} \stindex{import} \begin{verbatim} @@ -527,7 +527,7 @@ about how the module search works from inside a package.] [XXX Also should mention __import__().] \bifuncindex{__import__} -\section{The \keyword{global} statement} \label{global} +\section{The \keyword{global} statement\label{global}} \stindex{global} \begin{verbatim} @@ -567,7 +567,7 @@ containing the \keyword{exec} statement. The same applies to the \bifuncindex{execfile} \bifuncindex{compile} -\section{The {\tt exec} statement} \label{exec} +\section{The \keyword{exec} statement\label{exec}} \stindex{exec} \begin{verbatim} diff --git a/Doc/ref/ref7.tex b/Doc/ref/ref7.tex index 43338c1..2f0eb33 100644 --- a/Doc/ref/ref7.tex +++ b/Doc/ref/ref7.tex @@ -1,4 +1,4 @@ -\chapter{Compound statements} +\chapter{Compound statements\label{compound}} \indexii{compound}{statement} Compound statements contain (groups of) other statements; they affect @@ -60,7 +60,7 @@ statement, thus there are no ambiguities (the `dangling The formatting of the grammar rules in the following sections places each clause on a separate line for clarity. -\section{The \keyword{if} statement} +\section{The \keyword{if} statement\label{if}} \stindex{if} The \keyword{if} statement is used for conditional execution: @@ -80,7 +80,7 @@ present, is executed. \kwindex{elif} \kwindex{else} -\section{The \keyword{while} statement} +\section{The \keyword{while} statement\label{while}} \stindex{while} \indexii{loop}{statement} @@ -105,7 +105,7 @@ of the suite and goes back to testing the expression. \stindex{break} \stindex{continue} -\section{The \keyword{for} statement} +\section{The \keyword{for} statement\label{for}} \stindex{for} \indexii{loop}{statement} @@ -169,7 +169,7 @@ for x in a[:]: if x < 0: a.remove(x) \end{verbatim} -\section{The \keyword{try} statement} \label{try} +\section{The \keyword{try} statement\label{try}} \stindex{try} The \keyword{try} statement specifies exception handlers and/or cleanup @@ -271,7 +271,7 @@ restriction may be lifted in the future). \stindex{break} \stindex{continue} -\section{Function definitions} \label{function} +\section{Function definitions\label{function}} \indexii{function}{definition} A function definition defines a user-defined function object (see @@ -359,7 +359,7 @@ add1 = make_incrementer(1) print add1(3) # This prints '4' \end{verbatim} -\section{Class definitions} \label{class} +\section{Class definitions\label{class}} \indexii{class}{definition} A class definition defines a class object (see section \ref{types}): diff --git a/Doc/ref/ref8.tex b/Doc/ref/ref8.tex index fe83594..361884f 100644 --- a/Doc/ref/ref8.tex +++ b/Doc/ref/ref8.tex @@ -1,4 +1,4 @@ -\chapter{Top-level components} +\chapter{Top-level components\label{top-level}} 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, @@ -6,7 +6,7 @@ typed in interactively, from a module source file, etc. This chapter gives the syntax used in these cases. \index{interpreter} -\section{Complete Python programs} +\section{Complete Python programs\label{programs}} \index{program} While a language specification need not prescribe how the language @@ -43,7 +43,7 @@ program. \index{command line} \index{standard input} -\section{File input} +\section{File input\label{file-input}} All input read from non-interactive files has the same form: @@ -63,7 +63,7 @@ This syntax is used in the following situations: \end{itemize} -\section{Interactive input} +\section{Interactive input\label{interactive}} 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 line in interactive mode; this is needed to help the parser detect the end of the input. -\section{Expression input} +\section{Expression input\label{expression-input}} \index{input} There are two forms of expression input. Both ignore leading |