Something like this? >>> class V(Equality): ... def __radd__(r, l): ... return V(r.lhs+l, r.rhs+l) ... def __add__(l, r): ... if not isinstance(r, l.func): ... return r+l ### see below ... return l.func(l.lhs+r.lhs, l.rhs+r.rhs) ... >>> V(x,3) x == 3 >>> _ + 3 x + 3 == 6 >>> _ + V(x, 2) 2*x + 3 == 8
### I guess one has to watch for equality, too >>> _+Eq(-1,x) 2*x + 3 - (1 == x) == 8 - (1 == x) -- 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 post to this group, send email to sympy@googlegroups.com. Visit this group at http://groups.google.com/group/sympy?hl=en. For more options, visit https://groups.google.com/groups/opt_out.