1
0
infernal-interpreter/Junk.py

33 lines
601 B
Python

class JunkComparisonException (BaseException):
def __str__ (self):
return "Attempting to perform calculations involving junk values."
class Junk:
def __init__ (self, represents = None):
assert(represents == None or isinstance(represents, basestring))
self.repr = represents
def __str__ (self):
if self.repr:
return '['+self.repr+']'
return "[junk]"
def __repr__ (self):
return self.__str__()
def __add__ (self, other):
return self
def __radd__ (self, other):
return self
def __sub__ (self, other):
return self
def __rsub__ (self, other):
return self