Explorar o código

Added inequivalence operator to ExpressionBase.

Taddeus Kroes %!s(int64=14) %!d(string=hai) anos
pai
achega
acbc9fb7f8
Modificáronse 2 ficheiros con 8 adicións e 0 borrados
  1. 2 0
      TODO
  2. 6 0
      src/node.py

+ 2 - 0
TODO

@@ -105,3 +105,5 @@ Division of 0 by 1 reduces to 0.
  - Line generator: 'der(f(x), x)'  ->  'd/dx f(x)'
 
  - Create unit tests for parser preprocessor.
+
+ - Create unit tests for node inequivalece operator.

+ 6 - 0
src/node.py

@@ -165,6 +165,12 @@ class ExpressionBase(object):
 
         return s_root < o_root or s_exp < o_exp or s_coeff < o_coeff
 
+    def __ne__(self, other):
+        """
+        Check strict inequivalence, using the strict equivalence operator.
+        """
+        return not (self == other)
+
     def is_op(self, *ops):
         return not self.is_leaf and self.op in ops