[Python-ideas] new pickle semantics/API
tomerfiliba at gmail.com
Thu Jan 25 22:55:19 CET 2007
On 1/25/07, Collin Winter <collinw at gmail.com> wrote:
> How will e.g. classes be simplified? Can I simplify a dictionary with
> function objects for values?
well, pickle just saves them as a global name (modulename.classname).
so types would generally just return themselves as primitives, and let
the actual simplifier do the trick.
it may choose to save the type's dict, or just a global name.
that's up to the serializer-dependent simplifier.
it's good you mentioned that, because it reminded me of something
i forgot. for instance, code objects will be serialized by value,
so you could actually pickle functions and classes.
this means pyc files could become just a pickle of the module, i.e.:
pickle.dump(foo, open("foo.pyc", "w"))
but again, that's up to the serializer. an enhanced pickle could do
More information about the Python-ideas