[Python-checkins] CVS: python/dist/src/Doc/ref ref3.tex,1.60,1.61
Fred L. Drake
fdrake@users.sourceforge.net
Thu, 22 Feb 2001 13:28:06 -0800
Update of /cvsroot/python/python/dist/src/Doc/ref
In directory usw-pr-cvs1:/tmp/cvs-serv27843/ref
Modified Files:
ref3.tex
Log Message:
Sequence indexes are non-negative, not natural (0 is not a natural number).
Reported by Daniel May <mayds@ecn.purdue.edu>.
De-tabified everywhere.
Index: ref3.tex
===================================================================
RCS file: /cvsroot/python/python/dist/src/Doc/ref/ref3.tex,v
retrieving revision 1.60
retrieving revision 1.61
diff -C2 -r1.60 -r1.61
*** ref3.tex 2001/01/22 17:46:18 1.60
--- ref3.tex 2001/02/22 21:28:04 1.61
***************
*** 228,232 ****
\item[Sequences]
! These represent finite ordered sets indexed by natural numbers.
The built-in function \function{len()}\bifuncindex{len} returns the
number of items of a sequence.
--- 228,232 ----
\item[Sequences]
! 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.
***************
*** 1417,1470 ****
\item[1.] If \var{x} is a class instance:
! \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[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.
! \end{itemize}
\item[2.] If \var{y} is a class instance:
! \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[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.
! \end{itemize}
\item[3.] We only get here if neither \var{x} nor \var{y} is a class
instance.
! \begin{itemize}
! \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[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}
--- 1417,1470 ----
\item[1.] If \var{x} is a class instance:
! \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[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.
! \end{itemize}
\item[2.] If \var{y} is a class instance:
! \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[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.
! \end{itemize}
\item[3.] We only get here if neither \var{x} nor \var{y} is a class
instance.
! \begin{itemize}
! \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[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}