Perform constant folding.  If the result of applying the
        operator to the elements would be a fixed constant value,
        returns the result of applying the operator to the operands.
        Otherwise, returns an instance of ``Instructions`` containing
        the instructions necessary to apply the operator.

        :param elems: A list (or list-like object) containing the
                      elements.

        :returns: A list of one element, containing the instructions
                  necessary to implement the operator.

def fold(self, elems):
        """
        Perform constant folding.  If the result of applying the
        operator to the elements would be a fixed constant value,
        returns the result of applying the operator to the operands.
        Otherwise, returns an instance of ``Instructions`` containing
        the instructions necessary to apply the operator.

        :param elems: A list (or list-like object) containing the
                      elements.

        :returns: A list of one element, containing the instructions
                  necessary to implement the operator.
        """

        # Are the elements constants?
        if all(isinstance(e, Constant) for e in elems):
            return [Constant(self.op(*[e.value for e in elems]))]

        return [Instructions(elems[:] + [self])]