[Twisted-Python] Re: pickle apparently doesn't go with curry ...
Jonathan M. Lange
jml at mumak.net
Wed Nov 13 00:00:22 EST 2002
On Tue, Nov 12, 2002 at 07:20:12PM +0000, Michael Hudson wrote:
> "Patrick K. O'Brien" <pobrien at orbtech.com> writes:
>
> > On Tuesday 12 November 2002 11:06 am, Steve Waterbury wrote:
> > > Twisted Gurus:
> >
> > Not yet, but I'd like to be one day. ;-)
> >
> > > I'm using the "curry" recipe from the Python Cookbook
> > > (pretty much verbatim), and it appears to work fine in my
> > > code, but cPickle isn't happy about it:
> >
> > The short answer is that Python doesn't currently pickle nested class
> > and fucntion objects, i.e. those not defined at the top level of the
> > module.
>
> Unless something's changed since I last looked, you can't pickle
> functions at all.
>
>>> def foo():
... pass
...
>>> import cPickle
>>> cPickle.dump(foo, open('testpickle', 'w'))
>>> bar = cPickle.load(open('testpickle'))
I'd imagine this would work in most versions of python, given that
people have been pickling objects for countless generations.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://twistedmatrix.com/pipermail/twisted-python/attachments/20021113/7718f2cd/attachment.pgp
More information about the Twisted-Python
mailing list