[Python-checkins] CVS: python/dist/src/Doc/ref ref3.tex,1.64,1.65 ref5.tex,1.43,1.44
Guido van Rossum
gvanrossum@users.sourceforge.net
Fri, 20 Apr 2001 09:50:42 -0700
Update of /cvsroot/python/python/dist/src/Doc/ref
In directory usw-pr-cvs1:/tmp/cvs-serv7993/Doc/ref
Modified Files:
ref3.tex ref5.tex
Log Message:
Implement, test and document "key in dict" and "key not in dict".
I know some people don't like this -- if it's really controversial,
I'll take it out again. (If it's only Alex Martelli who doesn't like
it, that doesn't count as "real controversial" though. :-)
That's why this is a separate checkin from the iterators stuff I'm
about to check in next.
Index: ref3.tex
===================================================================
RCS file: /cvsroot/python/python/dist/src/Doc/ref/ref3.tex,v
retrieving revision 1.64
retrieving revision 1.65
diff -C2 -r1.64 -r1.65
*** ref3.tex 2001/04/13 15:54:41 1.64
--- ref3.tex 2001/04/20 16:50:40 1.65
***************
*** 1135,1139 ****
\method{__mul__()}, \method{__rmul__()} and \method{__imul__()} described
below; they should not define \method{__coerce__()} or other numerical
! operators.
\withsubitem{(mapping object method)}{
\ttindex{keys()}
--- 1135,1142 ----
\method{__mul__()}, \method{__rmul__()} and \method{__imul__()} described
below; they should not define \method{__coerce__()} or other numerical
! operators. It is recommended that both mappings and sequences
! implement the \method{__contains__}, to allow efficient use of the
! \code{in} operator; for mappings, \code{in} should be equivalent of
! \method{has_key()}; for sequences, it should search through the values.
\withsubitem{(mapping object method)}{
\ttindex{keys()}
***************
*** 1144,1148 ****
\ttindex{clear()}
\ttindex{copy()}
! \ttindex{update()}}
\withsubitem{(sequence object method)}{
\ttindex{append()}
--- 1147,1152 ----
\ttindex{clear()}
\ttindex{copy()}
! \ttindex{update()}
! \ttindex{__contains__()}}
\withsubitem{(sequence object method)}{
\ttindex{append()}
***************
*** 1159,1163 ****
\ttindex{__mul__()}
\ttindex{__rmul__()}
! \ttindex{__imul__()}}
\withsubitem{(numeric object method)}{\ttindex{__coerce__()}}
--- 1163,1168 ----
\ttindex{__mul__()}
\ttindex{__rmul__()}
! \ttindex{__imul__()}
! \ttindex{__contains__()}}
\withsubitem{(numeric object method)}{\ttindex{__coerce__()}}
Index: ref5.tex
===================================================================
RCS file: /cvsroot/python/python/dist/src/Doc/ref/ref5.tex,v
retrieving revision 1.43
retrieving revision 1.44
diff -C2 -r1.43 -r1.44
*** ref5.tex 2001/04/12 12:37:03 1.43
--- ref5.tex 2001/04/20 16:50:40 1.44
***************
*** 769,773 ****
object is a member of a set if the set is a sequence and contains an
element equal to that object. However, it is possible for an object
! to support membership tests without being a sequence.
For the list and tuple types, \code{\var{x} in \var{y}} is true if and
--- 769,775 ----
object is a member of a set if the set is a sequence and contains an
element equal to that object. However, it is possible for an object
! to support membership tests without being a sequence. In particular,
! dictionaries support memership testing as a nicer way of spelling
! \code{\var{key} in \var{dict}}; other mapping types may follow suit.
For the list and tuple types, \code{\var{x} in \var{y}} is true if and