I've just discovered a bug in my code which boiled down to the following, 
where a symbol "y" was given the same SymPy name as an existing symbol.

import sympy as sp
x = sp.Symbol('x')
y = sp.Symbol('y')

x == y # True
x is y # True; expected False
x + y # 2*x; expected x + x (which would have made the bug in my code more 
apparent)

The behaviour here is very surprising to me.  I would have expected x and y 
to be different Python objects with __repr__ methods which just so happen 
to return the same string.  Instead, x and y are apparently different 
Python names for the same object (x is y).

Is this intentional? I think I must misunderstand some deep design choice 
in SymPy, and I can't express my confusion well enough to Google it.  
Please help!


-- 
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/f0084d3b-db98-43cb-becd-020a368aec87%40googlegroups.com.

Reply via email to