[Python-checkins] python/nondist/peps pep-0307.txt,1.20,1.21

tim_one@users.sourceforge.net tim_one@users.sourceforge.net
2003年2月10日 13:25:28 -0800


Update of /cvsroot/python/python/nondist/peps
In directory sc8-pr-cvs1:/tmp/cvs-serv23524
Modified Files:
	pep-0307.txt 
Log Message:
Tried to clarify the point about classic classes and __reduce__.
Index: pep-0307.txt
===================================================================
RCS file: /cvsroot/python/python/nondist/peps/pep-0307.txt,v
retrieving revision 1.20
retrieving revision 1.21
diff -C2 -d -r1.20 -r1.21
*** pep-0307.txt	9 Feb 2003 17:16:45 -0000	1.20
--- pep-0307.txt	10 Feb 2003 21:25:25 -0000	1.21
***************
*** 143,149 ****
 though, and we'll refer to these collectively as __reduce__.
 
! IMPORTANT: a classic class cannot provide __reduce__
! functionality. It must use __getinitargs__ and/or __gestate__ to
! customize pickling. These are described below.
 
 __reduce__ must return either a string or a tuple. If it returns
--- 143,151 ----
 though, and we'll refer to these collectively as __reduce__.
 
! IMPORTANT: while a classic class can implement a __reduce__()
! method, pickling its instances ignores the method, so that a classic
! class cannot provide __reduce__ functionality in the sense intended
! here. A classic class must use __getinitargs__ and/or __gestate__
! to customize pickling. These are described below.
 
 __reduce__ must return either a string or a tuple. If it returns
***************
*** 625,629 ****
 
 - When the __reduce__ method is inherited from object, it is
! (unconditionally) replaced by a better one that uses the same 
 APIs as pickle protocol 2: __getnewargs__, __getstate__, and
 __setstate__, handling list and dict subclasses, and handling
--- 627,631 ----
 
 - When the __reduce__ method is inherited from object, it is
! (unconditionally) replaced by a better one that uses the same
 APIs as pickle protocol 2: __getnewargs__, __getstate__, and
 __setstate__, handling list and dict subclasses, and handling

AltStyle によって変換されたページ (->オリジナル) /