Dear Oscar,

Thank you.

On the upside, this shows that sympy has a robust user base -- the bug was picked up just 20 days ago and here I am stumbling on it independently.

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'.

Cheers,
        Bruce


On 07.04.21 15:55, Oscar Benjamin wrote:
On Wed, 7 Apr 2021 at 14:43, 'Bruce Allen' via sympy
<[email protected]> wrote:

David, Oscar,

Thank you for your help.

Oscar, the list 'u' was created in the course of a calculation, and
saved as a .pkl file. I then reloaded it and want to manipulate the
saved equations, of which u[7] is an example.  I found an even cleaner
example, see below.

I have the impression that when the .pkl file was reloaded, the identity
of the object

Symbol('a', real=True, positive=True)

contained within u[3] was set to a memory address and when I created the
object

Symbol('a', real=True, positive=True)

in the current session, that was left pointing to a *different* address.
   (See below.)

I can use "id(a)" to see what address the "current session variable a"
is pointing to.  Is there a simple way for me to understand what address
a=Symbol('a',real=True,positive=True) in the u[3] object is pointing to?
   Presumably these are different, even though the two variables have the
same name and the same properties.

If that behavior is correct, I may need some help to revise my mental
model of how sympy/python works (:-).

I don't think you need to adjust your mental model :)

I think this is just a bug to do with pickling symbols that have assumptions:
https://github.com/sympy/sympy/issues/21121

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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sympy/df498c7a-1857-9ab4-5253-4521c3efe337%40googlemail.com.

Reply via email to