Hi Philip,

On Fri, Oct 02, 2009 at 09:35:30AM -0700, Philip Guo wrote:
> I'm brand-new to PyPy, and here is my question: I want to selectively pickle
> Python objects that appear in application-level code, from *within* the
> interpreter.

What about writing a metaclass and keeping it all as portable, regular
Python code?  E.g.

    class MetaPickle(type):
        def __call__(self, *args, **kwds):
            x = type.__call__(self, *args, **kwds)
            pickle.dump(x, f)
            return x

    class X(object):
        __metaclass__ = MetaPickle

There are also ways to do it by patching the classes without changing
anything to their definition.  If you need more information about these
solutions, please ask in a general Python list.


A bientot,

Armin
_______________________________________________
[email protected]
http://codespeak.net/mailman/listinfo/pypy-dev

Reply via email to