This is probably due to the cache. Does it also happen in isympy with the
-C option?

Aaron Meurer

On Jun 22, 2012, at 2:13 PM, Guru Devanla <[email protected]> wrote:

Hello All,

Can someone explain why 2 objects in the following statements give me the
same id() value?


>>> A, B = symbols('A B', commutative=False)
>>> x = A*B
>>> print id(x)
169853492
>>> y = A*B
>>> print id(y)
169853492

I run into this problem while trying to implement some operation on Trace
module.

Say, I have  Tr(A*B*C) . Now, the user wants to create another instance of
Tr(C*A*B).   But, both objects are getting the same id, meaning I am not
able to create 2 different objects one which prints at Tr(A*B*C) and
another which prints as Tr(C*A*B).  Note, that I have not yet overridden
 _hashable_contents to compare the args ( using the  cyclic property of
trace).

Am I missing something basic?   Or is there a way to override this
 behavior, if necessary

Thanks
Guru




















 --
You received this message because you are subscribed to the Google Groups
"sympy" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/sympy/-/lFlq7OJjqlkJ.
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?hl=en.

-- 
You received this message because you are subscribed to the Google Groups 
"sympy" 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?hl=en.

Reply via email to