Comment #5 on issue 2684 by alvin.sa...@gmail.com: Deepcopy does not work on evaluate False
http://code.google.com/p/sympy/issues/detail?id=2684

I'm using Sympy in a project where this issue came up - that is, pickle was not able to handle Sympy Functions which were constructed using a keyword arg, such as evaluate=False.

I was able to mpnkey-patch a fix based on this post:
http://stackoverflow.com/questions/5238252/unpickling-new-style-with-kwargs-not-possible

The workaround which allowed me to progress is rather dirty, and I haven't tried it with a superclass (i.e. to get Mul(a,b,evaluate=False) to work):

def _Function__reduce__(self):
    args = self.__getnewargs__()
    kwargs = self._assumptions
    return new_Function, (self.__class__, args, kwargs), None
Function.__reduce__ = _Function__reduce__

def new_Function(cls, args, kwargs):
    return cls.__new__(cls, *args, **kwargs)

That's for sympy 0.6.7 and it's rather naive, but I'm putting this here with the hope to save someone else a bit of work when trying to completely resolve this issue....

--
You received this message because you are subscribed to the Google Groups 
"sympy-issues" group.
To post to this group, send email to sympy-issues@googlegroups.com.
To unsubscribe from this group, send email to 
sympy-issues+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sympy-issues?hl=en.

Reply via email to