[Python-Dev] Pickling w/ low overhead
M.-A. Lemburg
mal@lemburg.com
Tue, 03 Aug 1999 21:17:16 +0200
David Ascher wrote:
>
> On Tue, 3 Aug 1999, M.-A. Lemburg wrote:
>
> > Hmm, types can register their own pickling/unpickling functions
> > via copy_reg, so they can access the self.write method in pickle.py
> > to implement the write to file interface.
>
> Are you sure? My understanding of copy_reg is, as stated in the doc:
>
> pickle (type, function[, constructor])
> Declares that function should be used as a ``reduction'' function for
> objects of type or class type. function should return either a string
> or a tuple. The optional constructor parameter, if provided, is a
> callable object which can be used to reconstruct the object when
> called with the tuple of arguments returned by function at pickling
> time.
>
> How does one access the 'self.write method in pickle.py'?
Ooops. Sorry, that doesn't work... well at least not using "normal"
Python ;-) You could of course simply go up one stack frame and
then grab the self object and then... well, you know...
--
Marc-Andre Lemburg
______________________________________________________________________
Y2000: 150 days left
Business: http://www.lemburg.com/
Python Pages: http://www.lemburg.com/python/