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/CAHVvXxRVjWbtm5ZqChkubqa%3D0mdwrKoxiF36mTSadYsq5MpSYg%40mail.gmail.com.

Reply via email to