Comment #17 on issue 2587 by [email protected]: Strange printing at SymPy
Live
http://code.google.com/p/sympy/issues/detail?id=2587
Looks like Pickler has a field "fast" for disabling the optimization. I
wrote a fast_dumps function and it appears to work:
In [1]: from pickle import Pickler, loads
In [2]: from StringIO import StringIO
In [3]: def fast_dumps(obj, protocol=None):
...: file = StringIO()
...: p = Pickler(file, protocol)
...: p.fast = 1
...: p.dump(obj)
...: return file.getvalue()
...:
In [4]: f = x**2 + x**-2
In [5]: g = loads(fast_dumps(f))
In [6]: f
Out[6]:
2 1
x + --
2
x
In [7]: g
Out[7]:
2 1
x + --
2
x
I'll go ahead and make a pull request with this fix in SymPy Live, though a
note probably should be made somewhere in SymPy itself.
--
You received this message because you are subscribed to the Google Groups
"sympy-issues" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/sympy-issues?hl=en.