def string(self, **kwargs): ''' Format as "fraction(A, B)". ''' return Operation.string(self, **kwargs)
def string(self, **kwargs): if self.operands.is_single(): # Single operand: wrap it in square braces to show # we are treating it as an operator (a function). return '[' + self.operand.string() + ']' return Operation.string(self, **kwargs)