[Python-checkins] CVS: python/dist/src/Doc/ref ref5.tex,1.37,1.38

Fred L. Drake python-dev@python.org
Tue, 19 Sep 2000 11:10:10 -0700


Update of /cvsroot/python/python/dist/src/Doc/ref
In directory slayer.i.sourceforge.net:/tmp/cvs-serv15775

Modified Files:
	ref5.tex 
Log Message:

Many small clarifications, including many suggested by email.


Index: ref5.tex
===================================================================
RCS file: /cvsroot/python/python/dist/src/Doc/ref/ref5.tex,v
retrieving revision 1.37
retrieving revision 1.38
diff -C2 -r1.37 -r1.38
*** ref5.tex	2000/09/11 16:31:55	1.37
--- ref5.tex	2000/09/19 18:10:05	1.38
***************
*** 677,685 ****
  \index{comparison}
  
! Contrary to \C, all comparison operations in Python have the same
! priority, which is lower than that of any arithmetic, shifting or
! bitwise operation.  Also contrary to \C, expressions like
! \code{a < b < c} have the interpretation that is conventional in
! mathematics:
  \indexii{C}{language}
  
--- 677,684 ----
  \index{comparison}
  
! Unlike C, all comparison operations in Python have the same priority,
! which is lower than that of any arithmetic, shifting or bitwise
! operation.  Also unlike C, expressions like \code{a < b < c} have the
! interpretation that is conventional in mathematics:
  \indexii{C}{language}
  
***************
*** 709,717 ****
  The forms \code{<>} and \code{!=} are equivalent; for consistency with
  C, \code{!=} is preferred; where \code{!=} is mentioned below
! \code{<>} is also acceptable.  At some point in the (far) future,
! \code{<>} may become obsolete.
  
! The operators \texttt{"<", ">", "==", ">=", "<="}, and \texttt{"!="} compare
! the values of two objects.  The objects needn't have the same type.
  If both are numbers, they are coverted to a common type.  Otherwise,
  objects of different types \emph{always} compare unequal, and are
--- 708,717 ----
  The forms \code{<>} and \code{!=} are equivalent; for consistency with
  C, \code{!=} is preferred; where \code{!=} is mentioned below
! \code{<>} is also accepted.  The \code{<>} spelling is considered
! obsolescent.
  
! The operators \code{<}, \code{>}, \code{==}, \code{>=}, \code{<=}, and
! \code{!=} compare
! the values of two objects.  The objects need not have the same type.
  If both are numbers, they are coverted to a common type.  Otherwise,
  objects of different types \emph{always} compare unequal, and are
***************
*** 733,737 ****
  Strings are compared lexicographically using the numeric equivalents
  (the result of the built-in function \function{ord()}) of their
! characters.
  
  \item
--- 733,738 ----
  Strings are compared lexicographically using the numeric equivalents
  (the result of the built-in function \function{ord()}) of their
! characters.  Unicode and 8-bit strings are fully interoperable in this
! behavior.
  
  \item
***************
*** 766,774 ****
  \code{var{x} == \var{y}[\var{i}]} is true.
  
! For the Unicode and string types, \code{\var{x} in \var{y}} is true if and only
! if there exists such an index \var{i} such that
! \code{var{x} == \var{y}[\var{i}]} is true. If \code{\var{x}} is not
! a string of length \code{1} or a unicode object of length \code{1},
! a \exception{TypeError} exception is raised.
  
  For user-defined classes which define the \method{__contains__()} method,
--- 767,775 ----
  \code{var{x} == \var{y}[\var{i}]} is true.
  
! For the Unicode and string types, \code{\var{x} in \var{y}} is true if
! and only if there exists an index \var{i} such that \code{\var{x} ==
! \var{y}[\var{i}]} is true. If \code{\var{x}} is not a string or
! Unicode object of length \code{1}, a \exception{TypeError} exception
! is raised.
  
  For user-defined classes which define the \method{__contains__()} method,
***************
*** 777,782 ****
  
  For user-defined classes which do not define \method{__contains__()} and
! do define \var{__getitem__}, \code{\var{x} in \var{y}} is true if and only
! if there is a non-negative integer index \var{i} such that
  \code{\var{x} == \var{y}[\var{i}]}, and all lower integer indices
  do not raise \exception{IndexError} exception. (If any other exception
--- 778,783 ----
  
  For user-defined classes which do not define \method{__contains__()} and
! do define \method{__getitem__()}, \code{\var{x} in \var{y}} is true if
! and only if there is a non-negative integer index \var{i} such that
  \code{\var{x} == \var{y}[\var{i}]}, and all lower integer indices
  do not raise \exception{IndexError} exception. (If any other exception