Sequence indexes are non-negative, not natural (0 is not a natural number).
Reported by Daniel May <mayds@ecn.purdue.edu>. De-tabified everywhere.
This commit is contained in:
parent
7c30de65f4
commit
230d17d0d1
|
@ -227,7 +227,7 @@ and \code{z.imag}.
|
|||
\end{description} % Numbers
|
||||
|
||||
\item[Sequences]
|
||||
These represent finite ordered sets indexed by natural numbers.
|
||||
These represent finite ordered sets indexed by non-negative numbers.
|
||||
The built-in function \function{len()}\bifuncindex{len} returns the
|
||||
number of items of a sequence.
|
||||
When the length of a sequence is \var{n}, the
|
||||
|
@ -1416,55 +1416,55 @@ skipped.
|
|||
|
||||
\item[1.] If \var{x} is a class instance:
|
||||
|
||||
\begin{itemize}
|
||||
\begin{itemize}
|
||||
|
||||
\item[1a.] If \var{x} has a \method{__coerce__()} method:
|
||||
replace \var{x} and \var{y} with the 2-tuple returned by
|
||||
\code{\var{x}.__coerce__(\var{y})}; skip to step 2 if the
|
||||
coercion returns \code{None}.
|
||||
\item[1a.] If \var{x} has a \method{__coerce__()} method:
|
||||
replace \var{x} and \var{y} with the 2-tuple returned by
|
||||
\code{\var{x}.__coerce__(\var{y})}; skip to step 2 if the
|
||||
coercion returns \code{None}.
|
||||
|
||||
\item[1b.] If neither \var{x} nor \var{y} is a class instance
|
||||
after coercion, go to step 3.
|
||||
\item[1b.] If neither \var{x} nor \var{y} is a class instance
|
||||
after coercion, go to step 3.
|
||||
|
||||
\item[1c.] If \var{x} has a method \method{__op__()}, return
|
||||
\code{\var{x}.__op__(\var{y})}; otherwise, restore \var{x} and
|
||||
\var{y} to their value before step 1a.
|
||||
\item[1c.] If \var{x} has a method \method{__op__()}, return
|
||||
\code{\var{x}.__op__(\var{y})}; otherwise, restore \var{x} and
|
||||
\var{y} to their value before step 1a.
|
||||
|
||||
\end{itemize}
|
||||
\end{itemize}
|
||||
|
||||
\item[2.] If \var{y} is a class instance:
|
||||
|
||||
\begin{itemize}
|
||||
\begin{itemize}
|
||||
|
||||
\item[2a.] If \var{y} has a \method{__coerce__()} method:
|
||||
replace \var{y} and \var{x} with the 2-tuple returned by
|
||||
\code{\var{y}.__coerce__(\var{x})}; skip to step 3 if the
|
||||
coercion returns \code{None}.
|
||||
\item[2a.] If \var{y} has a \method{__coerce__()} method:
|
||||
replace \var{y} and \var{x} with the 2-tuple returned by
|
||||
\code{\var{y}.__coerce__(\var{x})}; skip to step 3 if the
|
||||
coercion returns \code{None}.
|
||||
|
||||
\item[2b.] If neither \var{x} nor \var{y} is a class instance
|
||||
after coercion, go to step 3.
|
||||
\item[2b.] If neither \var{x} nor \var{y} is a class instance
|
||||
after coercion, go to step 3.
|
||||
|
||||
\item[2b.] If \var{y} has a method \method{__rop__()}, return
|
||||
\code{\var{y}.__rop__(\var{x})}; otherwise, restore \var{x}
|
||||
and \var{y} to their value before step 2a.
|
||||
\item[2b.] If \var{y} has a method \method{__rop__()}, return
|
||||
\code{\var{y}.__rop__(\var{x})}; otherwise, restore \var{x}
|
||||
and \var{y} to their value before step 2a.
|
||||
|
||||
\end{itemize}
|
||||
\end{itemize}
|
||||
|
||||
\item[3.] We only get here if neither \var{x} nor \var{y} is a class
|
||||
instance.
|
||||
|
||||
\begin{itemize}
|
||||
\begin{itemize}
|
||||
|
||||
\item[3a.] If op is `\code{+}' and \var{x} is a sequence,
|
||||
sequence concatenation is invoked.
|
||||
\item[3a.] If op is `\code{+}' and \var{x} is a sequence,
|
||||
sequence concatenation is invoked.
|
||||
|
||||
\item[3b.] If op is `\code{*}' and one operand is a sequence
|
||||
and the other an integer, sequence repetition is invoked.
|
||||
\item[3b.] If op is `\code{*}' and one operand is a sequence
|
||||
and the other an integer, sequence repetition is invoked.
|
||||
|
||||
\item[3c.] Otherwise, both operands must be numbers; they are
|
||||
coerced to a common type if possible, and the numeric
|
||||
operation is invoked for that type.
|
||||
\item[3c.] Otherwise, both operands must be numbers; they are
|
||||
coerced to a common type if possible, and the numeric
|
||||
operation is invoked for that type.
|
||||
|
||||
\end{itemize}
|
||||
\end{itemize}
|
||||
|
||||
\end{itemize}
|
||||
|
|
Loading…
Reference in New Issue