Commit 0b791b7f authored by Taddeus Kroes's avatar Taddeus Kroes

Added __pos__ operator for negation reduction.

parent f51ea5e3
......@@ -145,8 +145,13 @@ class ExpressionBase(object):
def __pow__(self, other):
return ExpressionNode('^', self, to_expression(other))
def __pos__(self):
return self.reduce_negation()
def reduce_negation(self, n=1):
"""Remove n negation flags from the node."""
assert self.negated
return self.negate(-n)
def negate(self, n=1):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment