sympy/sympy — pull request #2844 by Tempel (2014-01-27 21:42:28+00:00)
Title: Relational: return BooleanAtoms instead of bools.

Also fixed tests in several locations to check for the new results, and corrected several areas where Python bools were expected; these areas should now handle Python bools and SymPy BooleanAtoms equally.

I realize this may be a contentious change, as `True` and `S.true` each have their place; see (this comment block in sympy.logic.boolalg)[https://github.com/sympy/sympy/blob/master/sympy/logic/boolalg.py#L57-L92] for reference. I feel that, since Relationals *are* "arbitrary symbolic Boolean[s]", it's more appropriate to have them simplify to SymPy objects instead of native Python bools. As an example, I have a current application where I substitute a series of symbols in an Equality; currently, I have to check whether it's reduced to `True` or `False` before substituting. My code would be simpler if I could just call the `subs` method on `S.true` and not worry about how it simplifies until the end. But I am open to arguments to leave the current behaviour too.

Note that, when using inequality operators, Python bools are still returned in some cases, since they do not always pass off to the Relational subclasses. For example, `(x < 2).subs(x, 2)` will return `S.true`, because it starts out as a `StrictLessThan` object, but `1 < 2` will return `True` because that logic is all within the `Number` class. Presumably consistency would be good here; I can try to change the behaviour of the second case if it's deemed worthwhile.