from thinglang.common import ObtainableValue
from thinglang.parser.tokens import BaseToken


class ArithmeticOperation(BaseToken, ObtainableValue):
    OPERATIONS = {
        "+": lambda rhs, lhs: rhs + lhs,
        "*": lambda rhs, lhs: rhs * lhs,
        "-": lambda rhs, lhs: rhs - lhs,
        "/": lambda rhs, lhs: rhs / lhs
    }

    def __init__(self, slice):
        super(ArithmeticOperation, self).__init__(slice)
        self.lhs, self.operator, self.rhs = slice

    def evaluate(self, stack):
        return self.OPERATIONS[self.operator.operator](self.lhs.evaluate(stack), self.rhs.evaluate(stack))

    def describe(self):
        return '{} {} {}'.format(self.lhs, self.operator, self.rhs)
@@ -652,16 +652,17 @@
 rn '
+%7C
 %7B%7D %7B%7D %7B%7D
 '.fo
@@ -657,16 +657,17 @@
 %7B%7D %7B%7D %7B%7D
+%7C
 '.format
@@ -675,34 +675,245 @@
 self
-.lhs, self.operator, self.rhs)
+%5B0%5D, self.operator, self%5B1%5D)%0A%0A    def replace_argument(self, original, replacement):%0A        self.arguments = %5Breplacement if x is original else x for x in self.arguments%5D%0A%0A    def __getitem__(self, item):%0A        return self.arguments%5Bitem%5D

Add replace method to Arithmetic operation