2015-12-19 15:55:14 +00:00
|
|
|
|
|
|
|
class JunkComparisonException (BaseException):
|
|
|
|
|
2018-02-06 19:20:09 +00:00
|
|
|
def __str__ (self):
|
|
|
|
return "Attempting to perform calculations involving junk values."
|
2015-12-19 15:55:14 +00:00
|
|
|
|
|
|
|
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
|
2015-12-19 15:55:14 +00:00
|
|
|
|
2018-02-06 19:56:33 +00:00
|
|
|
def __str__ (self):
|
|
|
|
if self.repr:
|
|
|
|
return '['+self.repr+']'
|
|
|
|
return "[junk]"
|
2015-12-19 15:55:14 +00:00
|
|
|
|
2018-02-06 19:56:33 +00:00
|
|
|
def __repr__ (self):
|
|
|
|
return self.__str__()
|
2015-12-19 15:55:14 +00:00
|
|
|
|
2018-02-06 19:56:33 +00:00
|
|
|
def __add__ (self, other):
|
|
|
|
return self
|
2015-12-19 15:55:14 +00:00
|
|
|
|
2018-02-06 19:56:33 +00:00
|
|
|
def __radd__ (self, other):
|
|
|
|
return self
|
2015-12-19 15:55:14 +00:00
|
|
|
|
2018-02-06 19:56:33 +00:00
|
|
|
def __sub__ (self, other):
|
|
|
|
return self
|
2015-12-19 15:55:14 +00:00
|
|
|
|
2018-02-06 19:56:33 +00:00
|
|
|
def __rsub__ (self, other):
|
|
|
|
return self
|
2018-02-06 19:20:09 +00:00
|
|
|
|