Status: New
Owner: ----
Labels: Type-Defect Priority-Medium

New issue 2030 by mattpap: Can't use 'boolean' operators with Relational classes
http://code.google.com/p/sympy/issues/detail?id=2030

In [1]: eq = Eq(x, 0)

In [2]: x + eq
Out[2]: x + x = 0

In [3]: x + 2*eq
Out[3]: x + 2⋅x = 0

In [4]: eq | (x > 1)
(...)
TypeError: unsupported operand type(s) for |: 'Equality' and 'StrictInequality'

In [5]: eq.__class__.mro()
Out[5]:
[<class 'sympy.core.relational.Equality'>, <class 'sympy.core.relational.Relational'>, <class 'sympy.core.expr. Expr'>, <class 'sympy.core.basic.Basic'>, <class 'sympy.core.assumptions.AssumeMeths'>, <class 'sympy.core.eval
f.EvalfMixin'>, <type 'object'>]

Currently Relational is a subclass of Expr, which doesn't make much sense (unless implemented properly, e.g. distribute arithmetics over lhs and rhs) and is improperly printed. This way, when working with relational solvers, we have to use explicit classes (And, Or).

--
You received this message because you are subscribed to the Google Groups 
"sympy-issues" group.
To post to this group, send email to sympy-iss...@googlegroups.com.
To unsubscribe from this group, send email to 
sympy-issues+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sympy-issues?hl=en.

Reply via email to