pickling lambdas?

Paul Rubin http
Sun Jan 4 00:45:03 CET 2004

"John Roth" <newsgroups at jhrothjr.com> writes:
> > however, upon google searching for "python lambda pickle" i find 2
> > posts, one including gvr, which apparently demonstrate that this was
> > being attempted and even suggest that it is feasible.  has this become
> > available yet, or will it be soon?
> Why do you want to do this? According to the docs, all that
> is saved for a function or a class is the name. Code, data and
> so forth is not saved, so it makes no sense to try to pickle
> a lambda unless you've bound it to a name at the module level. 

I think the idea may be to pickle a closure, to save the data inside
it.  I do remember some mention about pickling generators.  Anyway, in
Python 2.x the closest you can come to that is pickling class

More information about the Python-list mailing list