Am 24.03.2015 um 12:28 schrieb Paul Royik:
> Maybe this is property of Python, but I'm not aware about it.
>
> expr = 1/(2*sin(x/2 + pi/4)*cos(x/2 + pi/4))
> equation = Eq(expr,expr)
> equation == True # outputs True
> equation is True # outputs False
>
> Why True equation is not True?
In Python, "==" is value equality while "is" is object identity.
The differences are relevant in two ways:
1) "==" may change if you modify an object, "is" never does. This is
less relevant for SymPy because SymPy objects usually are not modified.
2) "is" cannot be redefined, "==" can. SymPy's S.true has its "=="
redefined so that it compares equal with "==".
> Moreover, in IDE in which I'm working, when I write equation != True, it
> tells me "this inspection detects equality comparison with a boolean
> literal".
It's telling you that writing
xxx == True
is silly because you can simply write
xxx