[Python-checkins] python/nondist/peps pep-0307.txt,1.24,1.25

tim_one@users.sourceforge.net tim_one@users.sourceforge.net
Mon, 10 Feb 2003 14:13:38 -0800


Update of /cvsroot/python/python/nondist/peps
In directory sc8-pr-cvs1:/tmp/cvs-serv16647

Modified Files:
	pep-0307.txt 
Log Message:
Clarified the distinction between pickling time and unpickling time
where that seemed to help, and made explicit where "the object" came
from originally in the descriptions of the optional __reduce__ tuple
elements.


Index: pep-0307.txt
===================================================================
RCS file: /cvsroot/python/python/nondist/peps/pep-0307.txt,v
retrieving revision 1.24
retrieving revision 1.25
diff -C2 -d -r1.24 -r1.25
*** pep-0307.txt	10 Feb 2003 21:44:25 -0000	1.24
--- pep-0307.txt	10 Feb 2003 22:13:34 -0000	1.25
***************
*** 182,185 ****
--- 182,190 ----
                   deprecated.
  
+     Unpickling invokes function(*arguments) to create an initial object,
+     called obj below.  If the remaining items are left off, that's the end
+     of unpickling and obj is the result.    Else obj is modified at
+     unpickling time by each item specified, as follows.
+ 
      state        Optional.
                   Additional state.  If this is not None, the state is
***************
*** 188,194 ****
                   defined, a default implementation is provided, which
                   assumes that state is a dictionary mapping instance
!                  variable names to their values, and calls
!                  obj.__dict__.update(state) or "for k, v in
!                  state.items(): obj[k] = v", if update() call fails.
  
      listitems    Optional, and new in this PEP.
--- 193,205 ----
                   defined, a default implementation is provided, which
                   assumes that state is a dictionary mapping instance
!                  variable names to their values.  The default
!                  implementation calls
! 
!                      obj.__dict__.update(state)
! 
!                  or, if the update() call fails,
! 
!                      for k, v in state.items():
!                          obj[k] = v
  
      listitems    Optional, and new in this PEP.
***************
*** 204,208 ****
                   of items to append, so both must be supported.)
  
!     dictitems    Optionals, and new in this PEP.
                   If this is not None, it should be an iterator (not a
                   sequence!) yielding successive dictionary items, which
--- 215,219 ----
                   of items to append, so both must be supported.)
  
!     dictitems    Optional, and new in this PEP.
                   If this is not None, it should be an iterator (not a
                   sequence!) yielding successive dictionary items, which
***************
*** 217,222 ****
      the __setstate__ call was to return a two-tuple from __reduce__.
      (But pickle.py would not pickle state if it was None.)  In Python
!     2.3, __setstate__ will never be called when __reduce__ returns a
!     state with value None.
  
      A __reduce__ implementation that needs to work both under Python
--- 228,233 ----
      the __setstate__ call was to return a two-tuple from __reduce__.
      (But pickle.py would not pickle state if it was None.)  In Python
!     2.3, __setstate__ will never be called at unpickling time when
!     __reduce__ returns a state with value None at pickling time.
  
      A __reduce__ implementation that needs to work both under Python
***************
*** 225,229 ****
      and dictitems features.  If this value is >= "2.0" then they are
      supported.  If not, any list or dict items should be incorporated
!     somehow in the 'state' return value; the __setstate__ method
      should be prepared to accept list or dict items as part of the
      state (how this is done is up to the application).
--- 236,240 ----
      and dictitems features.  If this value is >= "2.0" then they are
      supported.  If not, any list or dict items should be incorporated
!     somehow in the 'state' return value, and the __setstate__ method
      should be prepared to accept list or dict items as part of the
      state (how this is done is up to the application).