Comment #2 on issue 1953 by asmeurer: inconsistency between "in" and "has"
http://code.google.com/p/sympy/issues/detail?id=1953
is is not the same as ==. a is b should return True only if a and b point
exactly to the same object in memory.
In [10]: a = 1024
In [11]: b = 1024
In [12]: a is b
Out[12]: False
In [13]: a == b
Out[13]: True
A conversation on IRC the other day alerted me to the fact that will be
different for smaller ints like 1 because of
optimization in Cpython, but we shouldn't rely on that because it won't
necessarily hold in other
implementations like Jython.
is is faster than ==, but we should only use it when we know that the
compare objects will have the same
address, i.e., when they are Singletons, which exist for exactly that
purpose.
By the way, I'm wondering if eq.has(xr) should be returning False instead
of the other way around.
Also, that has nothing to do with your change. I get the same thing in
master:
In [14]: f(x).diff(x) is f(x).diff(x)
Out[14]: True
In [15]: Derivative(f(x),x) is Derivative(f(x),x)
Out[15]: False
--
You received this message because you are subscribed to the Google Groups
"sympy-issues" 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-issues?hl=en.