diff options
author | Fred Drake <fdrake@acm.org> | 2000-04-03 04:51:13 (GMT) |
---|---|---|
committer | Fred Drake <fdrake@acm.org> | 2000-04-03 04:51:13 (GMT) |
commit | e15956b46515dfc5cf258b7109e2b7b330c27e5f (patch) | |
tree | 0776ca09eb49808534b37e8f5320af8da5c0290c /Doc/ref | |
parent | 20082d92f2e5fc7736b3fb1839380cc7c0133165 (diff) | |
download | cpython-e15956b46515dfc5cf258b7109e2b7b330c27e5f.zip cpython-e15956b46515dfc5cf258b7109e2b7b330c27e5f.tar.gz cpython-e15956b46515dfc5cf258b7109e2b7b330c27e5f.tar.bz2 |
Merged changes from the 1.5.2p2 release.
Diffstat (limited to 'Doc/ref')
-rw-r--r-- | Doc/ref/ref2.tex | 14 | ||||
-rw-r--r-- | Doc/ref/ref3.tex | 35 | ||||
-rw-r--r-- | Doc/ref/ref4.tex | 14 | ||||
-rw-r--r-- | Doc/ref/ref5.tex | 10 | ||||
-rw-r--r-- | Doc/ref/ref7.tex | 4 |
5 files changed, 40 insertions, 37 deletions
diff --git a/Doc/ref/ref2.tex b/Doc/ref/ref2.tex index 8d106b6..ba4c684 100644 --- a/Doc/ref/ref2.tex +++ b/Doc/ref/ref2.tex @@ -148,7 +148,7 @@ text editors on non-UNIX platforms, it is unwise to use a mixture of spaces and tabs for the indentation in a single source file. A formfeed character may be present at the start of the line; it will -be ignored for the indentation calculations above. A formfeed +be ignored for the indentation calculations above. Formfeed characters occurring elsewhere in the leading whitespace have an undefined effect (for instance, they may reset the space count to zero). @@ -369,7 +369,9 @@ characters: a backslash and a double quote; \code{r"\e"} is not a value string literal (even a raw string cannot end in an odd number of backslashes). Specifically, \emph{a raw string cannot end in a single backslash} (since the backslash would escape the following quote -character). +character). Note also that a single backslash followed by a newline +is interpreted as those two characters as part of the string, +\emph{not} as a line continuation. \subsection{String literal concatenation\label{string-catenation}} @@ -464,7 +466,9 @@ exponent: ("e"|"E") ["+"|"-"] digit+ \end{verbatim} Note that the integer part of a floating point number cannot look like -an octal integer. +an octal integer, though the exponent may look like an octal literal +but will always be interpreted using radix 10. For example, +\samp{1e010} is legal, while \samp{07.1} is a syntax error. The allowed range of floating point literals is implementation-dependent. Some examples of floating point literals: @@ -485,7 +489,7 @@ Imaginary literals are described by the following lexical definitions: imagnumber: (floatnumber | intpart) ("j"|"J") \end{verbatim} -An imaginary literals yields a complex number with a real part of +An imaginary literal yields a complex number with a real part of 0.0. Complex numbers are represented as a pair of floating point numbers and have the same restrictions on their range. To create a complex number with a nonzero real part, add a floating point number @@ -522,7 +526,7 @@ The following tokens serve as delimiters in the grammar: \end{verbatim} The period can also occur in floating-point and imaginary literals. A -sequence of three periods has a special meaning as ellipses in slices. +sequence of three periods has a special meaning as an ellipsis in slices. The following printing ASCII characters have special meaning as part of other tokens or are otherwise significant to the lexical analyzer: diff --git a/Doc/ref/ref3.tex b/Doc/ref/ref3.tex index cb861cd..7cc0762 100644 --- a/Doc/ref/ref3.tex +++ b/Doc/ref/ref3.tex @@ -144,7 +144,6 @@ arithmetic operators and arithmetic built-in functions. Numeric objects are immutable; once created their value never changes. Python numbers are of course strongly related to mathematical numbers, but subject to the limitations of numerical representation in computers. -\obindex{number} \obindex{numeric} Python distinguishes between integers and floating point numbers: @@ -162,7 +161,7 @@ There are two types of integers: These represent numbers in the range -2147483648 through 2147483647. (The range may be larger on machines with a larger natural word size, but not smaller.) -When the result of an operation falls outside this range, the +When the result of an operation would fall outside this range, the exception \exception{OverflowError} is raised. For the purpose of shift and mask operations, integers are assumed to have a binary, 2's complement notation using 32 or more bits, and @@ -221,7 +220,7 @@ number of items of a sequence. When the lenth of a sequence is \var{n}, the index set contains the numbers 0, 1, \ldots, \var{n}-1. Item \var{i} of sequence \var{a} is selected by \code{\var{a}[\var{i}]}. -\obindex{seqence} +\obindex{sequence} \index{index operation} \index{item selection} \index{subscription} @@ -618,7 +617,7 @@ instance dictionary directly. Class instances can pretend to be numbers, sequences, or mappings if they have methods with certain special names. See section \ref{specialnames}, ``Special method names.'' -\obindex{number} +\obindex{numeric} \obindex{sequence} \obindex{mapping} @@ -702,15 +701,14 @@ a number of flags for the interpreter. \ttindex{co_stacksize} \ttindex{co_varnames}} -The following flag bits are defined for \member{co_flags}: bit 2 is set -if the function uses the \samp{*arguments} syntax to accept an -arbitrary number of positional arguments; bit 3 is set if the function -uses the \samp{**keywords} syntax to accept arbitrary keyword -arguments; other bits are used internally or reserved for future use. -If a code object represents a function, the first item in -\member{co_consts} is the documentation string of the -function, or \code{None} if undefined. -\index{documentation string} +The following flag bits are defined for \member{co_flags}: bit +\code{0x04} is set if the function uses the \samp{*arguments} syntax +to accept an arbitrary number of positional arguments; bit +\code{0x08} is set if the function uses the \samp{**keywords} syntax +to accept arbitrary keyword arguments; other bits are used internally +or reserved for future use. If\index{documentation string} a code +object represents a function, the first item in \member{co_consts} is +the documentation string of the function, or \code{None} if undefined. \item[Frame objects] Frame objects represent execution frames. They may occur in traceback @@ -1098,10 +1096,13 @@ three methods. Called to implement evaluation of \code{\var{self}[\var{i}:\var{j}]}. The returned object should be of the same type as \var{self}. Note that missing \var{i} or \var{j} in the slice expression are replaced -by zero or \code{sys.maxint}, respectively, and no further -transformations on the indices is performed. The interpretation of -negative indices and indices larger than the length of the sequence is -up to the method. +by zero or \code{sys.maxint}, respectively. If negative indexes are +used in the slice, the length of the sequence is added to that index. +If the instance does not implement the \method{__len__()} method, an +\exception{AttributeError} is raised. +No guarantee is made that indexes adjusted this way are not still +negative. Indexes which are greater than the length of the sequence +are not modified. \end{methoddesc} \begin{methoddesc}[sequence object]{__setslice__}{self, i, j, sequence} diff --git a/Doc/ref/ref4.tex b/Doc/ref/ref4.tex index 673fea3..636bc1d 100644 --- a/Doc/ref/ref4.tex +++ b/Doc/ref/ref4.tex @@ -183,11 +183,11 @@ statement. The \keyword{try} ... \keyword{finally} statement specifies cleanup code which does not handle the exception, but is executed whether an exception occurred or not in the preceding code. -Python uses the ``termination'' model of error handling: an exception -handler can find out what happened and continue execution at an outer -level, but it cannot repair the cause of the error and retry the -failing operation (except by re-entering the offending piece of -code from the top). +Python uses the ``termination'' \index{termination model}model of +error handling: an exception handler can find out what happened and +continue execution at an outer level, but it cannot repair the cause +of the error and retry the failing operation (except by re-entering +the offending piece of code from the top). When an exception is not handled at all, the interpreter terminates execution of the program, or returns to its interactive main loop. In @@ -210,5 +210,5 @@ selected exception handler as additional information. For class exceptions, this object must be an instance of the exception class being raised. -See also the description of the \keyword{try} and \keyword{raise} -statements in chapter \ref{compound}. +See also the description of the \keyword{try} statement in section +\ref{try} and \keyword{raise} statement in section \ref{raise}. diff --git a/Doc/ref/ref5.tex b/Doc/ref/ref5.tex index 72a2053..5bca8ed 100644 --- a/Doc/ref/ref5.tex +++ b/Doc/ref/ref5.tex @@ -115,7 +115,7 @@ evaluations of literals with the same value (either the same occurrence in the program text or a different occurrence) may obtain the same object or a different object with the same value. \indexiii{immutable}{data}{type} -\indexii{immutable}{objects} +\indexii{immutable}{object} \subsection{Parenthesized forms\label{parenthesized}} \index{parenthesized form} @@ -189,7 +189,7 @@ section \ref{types}. (To summarize,the key type should be hashable, which excludes all mutable objects.) Clashes between duplicate keys are not detected; the last datum (textually rightmost in the display) stored for a given key value prevails. -\indexii{immutable}{objects} +\indexii{immutable}{object} \subsection{String conversions\label{string-conversions}} \indexii{string}{conversion} @@ -338,7 +338,7 @@ extended slicing.\indexii{extended}{slicing} The semantics for a simple slicing are as follows. The primary must evaluate to a sequence object. The lower and upper bound expressions, if present, must evaluate to plain integers; defaults are zero and the -sequence's length, respectively. If either bound is negative, the +\code{sys.maxint}, respectively. If either bound is negative, the sequence's length is added to it. The slicing now selects all items with index \var{k} such that \code{\var{i} <= \var{k} < \var{j}} where \var{i} @@ -507,7 +507,7 @@ power, or a negative floating point number to a broken power), a \exception{TypeError} exception is raised. -\section{Unary arithmetic operations\label{unary}} +\section{Unary arithmetic operations \label{unary}} \indexiii{unary}{arithmetic}{operation} \indexiii{unary}{bit-wise}{operation} @@ -526,7 +526,7 @@ The unary \code{+} (plus) operator yields its numeric argument unchanged. \index{plus} -The unary \code{~} (invert) operator yields the bit-wise inversion +The unary \code{\~} (invert) operator yields the bit-wise inversion of its plain or long integer argument. The bit-wise inversion of \code{x} is defined as \code{-(x+1)}. It only applies to integral numbers. diff --git a/Doc/ref/ref7.tex b/Doc/ref/ref7.tex index 7538caa..097bbcd 100644 --- a/Doc/ref/ref7.tex +++ b/Doc/ref/ref7.tex @@ -306,9 +306,7 @@ default value, the corresponding argument may be omitted from a call, in which case the parameter's default value is substituted. If a parameter has a default value, all following parameters must also have a default value --- this is a syntactic restriction that is not -expressed by the grammar.\footnote{ -Currently this is not checked; instead, \code{def f(a=1, b)} is -interpreted as \code{def f(a=1, b=None)}.} +expressed by the grammar. \indexiii{default}{parameter}{value} \strong{Default parameter values are evaluated when the function |