[Python-checkins] python/dist/src/Doc/lib libuserdict.tex,1.21,1.22 libshelve.tex,1.14,1.15

rhettinger@users.sourceforge.net rhettinger@users.sourceforge.net
Thu, 14 Nov 2002 22:46:15 -0800


Update of /cvsroot/python/python/dist/src/Doc/lib
In directory usw-pr-cvs1:/tmp/cvs-serv2280/Doc/lib

Modified Files:
	libuserdict.tex libshelve.tex 
Log Message:
SF patch #520382:  Expand shelve.py to have a full dictionary interface
and add a mixin to UserDict.py to make it easier to implement a full
dictionary interface.



Index: libuserdict.tex
===================================================================
RCS file: /cvsroot/python/python/dist/src/Doc/lib/libuserdict.tex,v
retrieving revision 1.21
retrieving revision 1.22
diff -C2 -d -r1.21 -r1.22
*** libuserdict.tex	30 Jun 2002 04:32:38 -0000	1.21
--- libuserdict.tex	15 Nov 2002 06:46:13 -0000	1.22
***************
*** 16,20 ****
  can add new behaviors to dictionaries.
  
! The \module{UserDict} module defines the \class{UserDict} class:
  
  \begin{classdesc}{UserDict}{\optional{initialdata}}
--- 16,26 ----
  can add new behaviors to dictionaries.
  
! The module also defines a mixin defining all dictionary methods for
! classes that already have a minimum mapping interface.  This greatly
! simplifies writing classes that need to be substitutable for
! dictionaries (such as the shelve module).
! 
! The \module{UserDict} module defines the \class{UserDict} class
! and \class{DictMixin}:
  
  \begin{classdesc}{UserDict}{\optional{initialdata}}
***************
*** 35,38 ****
--- 41,61 ----
  class.
  \end{memberdesc}
+ 
+ \begin{classdesc}{DictMixin}{}
+ Mixin defining all dictionary methods for classes that already have
+ a minimum dictionary interface including\method{__getitem__},
+ \method{__setitem__}, \method{__delitem__}, and \method{keys}.
+ 
+ This mixin should be used as a superclass.  Adding each of the
+ above methods adds progressively more functionality.  For instance,
+ the absence of \method{__delitem__} precludes only \method{pop}
+ and \method{popitem}.
+ 
+ While the four methods listed above are sufficient to support the
+ entire dictionary interface, progessively more efficiency comes
+ with defining \method{__contains__}, \method{__iter__}, and
+ \method{iteritems}.
+ 
+ \end{classdesc}
  
  

Index: libshelve.tex
===================================================================
RCS file: /cvsroot/python/python/dist/src/Doc/lib/libshelve.tex,v
retrieving revision 1.14
retrieving revision 1.15
diff -C2 -d -r1.14 -r1.15
*** libshelve.tex	16 Jul 2000 19:01:10 -0000	1.14
--- libshelve.tex	15 Nov 2002 06:46:13 -0000	1.15
***************
*** 34,37 ****
--- 34,41 ----
  \end{verbatim}
  
+ In addition to the above, shelve supports all methods that are
+ supported by dictionaries.  This eases the transition from dictionary
+ based scripts to those requiring persistent storage.
+ 
  Restrictions: