1
0
infernal-interpreter/infernal_interpreter/Junk.py

33 lines
682 B
Python
Raw Normal View History

class JunkComparisonException (BaseException):
2018-02-06 19:20:09 +00:00
def __str__ (self):
return "Attempting to perform calculations involving junk values."
class Junk:
2024-07-09 23:03:12 +00:00
def __init__ (self, represents: str = None):
assert represents is None or isinstance(represents, str)
2018-02-06 19:56:33 +00:00
self.repr = represents
2018-02-06 19:56:33 +00:00
def __str__ (self):
if self.repr:
return '['+self.repr+']'
return "[junk]"
2018-02-06 19:56:33 +00:00
def __repr__ (self):
return self.__str__()
2018-02-06 19:56:33 +00:00
def __add__ (self, other):
return self
2018-02-06 19:56:33 +00:00
def __radd__ (self, other):
return self
2018-02-06 19:56:33 +00:00
def __sub__ (self, other):
return self
2018-02-06 19:56:33 +00:00
def __rsub__ (self, other):
return self
2018-02-06 19:20:09 +00:00