[Python-checkins] CVS: python/dist/src/Doc/lib libstdtypes.tex,1.27,1.28

Guido van Rossum python-dev@python.org
Tue, 8 Aug 2000 09:15:51 -0700


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

Modified Files:
	libstdtypes.tex 
Log Message:
Barry's patch to document the new setdefault() method.  Slightly
clarified the summary for default() in the table to indicate the side
effect.


Index: libstdtypes.tex
===================================================================
RCS file: /cvsroot/python/python/dist/src/Doc/lib/libstdtypes.tex,v
retrieving revision 1.27
retrieving revision 1.28
diff -C2 -r1.27 -r1.28
*** libstdtypes.tex	2000/08/01 00:07:17	1.27
--- libstdtypes.tex	2000/08/08 16:15:49	1.28
***************
*** 592,595 ****
--- 592,599 ----
             else \var{x}}
            {(4)}
+   \lineiii{\var{a}.setdefault(\var{k}\optional{, \var{x}})}
+           {\code{\var{a}[\var{k}]} if \code{\var{a}.has_key(\var{k})},
+            else \var{x} (also setting it)}
+           {(5)}
  \end{tableiii}
  
***************
*** 612,615 ****
--- 616,623 ----
  instead it returns \var{x}.  \var{x} is optional; when \var{x} is not
  provided and \var{k} is not in the map, \code{None} is returned.
+ 
+ \item[(5)] \function{setdefault()} is like \function{get()}, except
+ that if \var{k} is missing, \var{x} is both returned and inserted into
+ the dictionary as the value of \var{k}.
  \end{description}