Assuming symbols with the same names but different assumptions are not 
being used, couldn't one just "refresh" the unpickled expression by pairing 
the pickled symbols with current session variables by name? Does this work?

unpickle = a # an expression that was unpickled
reps= {}
for i in unpickle.atoms(Symbol):
    reps[i] = var(str(i), **i.assumptions0)
refresh = unpickle.xreplace(reps)


On Wednesday, April 7, 2021 at 9:49:55 AM UTC-5 Oscar wrote:

> On Wed, 7 Apr 2021 at 15:27, 'Bruce Allen' via sympy
> <sy...@googlegroups.com> wrote:
> >
> > On the downside, this makes it hard to work on a calculation which
> > requires large numbers of CPU hours and needs to be checkpointed and 
> saved.
> >
> > Do you know of any workarounds? Or is there an alternative to
> > pickle.save() and pickle.load() for this, which works well with sympy?
> > The only reason I am using pickle is because it is what popped up when I
> > googled 'save python data'.
>
> The simplest workaround is to use `srepr` and `eval`.
>
>
> Oscar
>

-- 
You received this message because you are subscribed to the Google Groups 
"sympy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sympy+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sympy/37f0f9c8-a07e-4ebc-90fd-367220a039a5n%40googlegroups.com.

Reply via email to