[Python-checkins] python/dist/src/Doc/lib libpickle.tex,1.47,1.48 (original) (raw)
fdrake at users.sourceforge.net fdrake at users.sourceforge.net
Wed May 5 00:54:40 EDT 2004
- Previous message: [Python-checkins] python/dist/src/Doc/lib libcopy.tex, 1.16, 1.16.42.1
- Next message: [Python-checkins] python/dist/src/Doc/lib libpickle.tex,1.48,1.49
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12835
Modified Files: libpickle.tex Log Message:
- note that getinitargs() is only for old-style classes
- describe getnewargs() (closes SF bug #873246)
Index: libpickle.tex
RCS file: /cvsroot/python/python/dist/src/Doc/lib/libpickle.tex,v retrieving revision 1.47 retrieving revision 1.48 diff -C2 -d -r1.47 -r1.48 *** libpickle.tex 8 Jan 2004 15:01:08 -0000 1.47 --- libpickle.tex 5 May 2004 04:54:37 -0000 1.48
*** 449,454 **** When a pickled class instance is unpickled, its \method{init()} method is normally \emph{not} invoked. If it is desirable that the ! \method{init()} method be called on unpickling, a class can define ! a method \method{getinitargs()}, which should return a \emph{tuple} containing the arguments to be passed to the class constructor (i.e. \method{init()}). The --- 449,454 ---- When a pickled class instance is unpickled, its \method{init()} method is normally \emph{not} invoked. If it is desirable that the ! \method{init()} method be called on unpickling, an old-style class ! can define a method \method{getinitargs()}, which should return a \emph{tuple} containing the arguments to be passed to the class constructor (i.e. \method{init()}). The
*** 459,462 **** --- 459,477 ---- \withsubitem{(instance constructor)}{\ttindex{init()}}
- New-style types can provide a \method{getnewargs()} method that is
- used for protocol 2. Implementing this method is needed if the type
- establishes some internal invariants when the instance is created, or
- if the memory allocation is affected by the values passed to the
- \method{new()} method for the type (as it is for tuples and
- strings). Instances of a new-style type \class{C} are created using
- \begin{alltt}
- obj = C.new(C, *\var{args})
- \end{alltt}
- where \var{args} is the result of calling \method{getnewargs()} on
- the original object; if there is no \method{getnewargs()}, an
- empty tuple is assumed.
- \withsubitem{(copy protocol)}{ \ttindex{getstate()}\ttindex{setstate()}}
- Previous message: [Python-checkins] python/dist/src/Doc/lib libcopy.tex, 1.16, 1.16.42.1
- Next message: [Python-checkins] python/dist/src/Doc/lib libpickle.tex,1.48,1.49
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]