[Python-checkins] python/dist/src/Lib pickle.py,1.75,1.76

tim_one@users.sourceforge.net tim_one@users.sourceforge.net
Mon, 27 Jan 2003 13:22:13 -0800


Update of /cvsroot/python/python/dist/src/Lib
In directory sc8-pr-cvs1:/tmp/cvs-serv512/python/Lib

Modified Files:
	pickle.py 
Log Message:
memoize():  Reworded the docs to try to disentangle the Pickler's memo
dict from the Unpickler's memo (which is a different beast!).


Index: pickle.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/pickle.py,v
retrieving revision 1.75
retrieving revision 1.76
diff -C2 -d -r1.75 -r1.76
*** pickle.py	27 Jan 2003 21:15:36 -0000	1.75
--- pickle.py	27 Jan 2003 21:22:10 -0000	1.76
***************
*** 176,187 ****
          """Store an object in the memo."""
  
!         # The memo is a dictionary mapping object ids to 2-tuples
!         # that contains the memo value and the object being memoized.
!         # The memo value is written to the pickle and will become
          # the key in the Unpickler's memo.  The object is stored in the
!         # memo so that transient objects are kept alive during pickling.
  
!         # The use of the memo length as the memo value is just a convention.
!         # The only requirement is that the memo values by unique.
          d = id(obj)
          memo_len = len(self.memo)
--- 176,191 ----
          """Store an object in the memo."""
  
!         # The Pickler memo is a dictionary mapping object ids to 2-tuples
!         # that contain the Unpickler memo key and the object being memoized.
!         # The memo key is written to the pickle and will become
          # the key in the Unpickler's memo.  The object is stored in the
!         # Pickler memo so that transient objects are kept alive during
!         # pickling.
  
!         # The use of the Unpickler memo length as the memo key is just a
!         # convention.  The only requirement is that the memo values be unique.
!         # But there appears no advantage to any other scheme, and this
!         # scheme allows the Unpickler memo to implemented as a plain (but
!         # growable) array, indexed by memo key.
          d = id(obj)
          memo_len = len(self.memo)