expression.py 581 B

123456789101112131415161718
  1. #class Expression(object):
  2. # """Class used to hold a mathematical expression."""
  3. #
  4. # magic_operator_map = {
  5. # int.__add__: '%s + %s',
  6. # int.__sub__: '%s - %s',
  7. # int.__mul__: '%s * %s',
  8. # int.__div__: '%s / %s',
  9. # int.__neg__: '-%s',
  10. # int.__pow__: '%s**%s',
  11. # }
  12. #
  13. # def __init__(self, operator, *args):
  14. # super(Expression, self).__init__()
  15. # self.operator, self.args = args[0], args[1:]
  16. #
  17. # def __str__(self):
  18. # return self.magic_operator_map[self.operator] % self.args