1
0
infernal-interpreter/infernal_interpreter/Junk.py
2024-07-10 01:15:47 +02:00

33 lines
642 B
Python

import dataclasses
class JunkComparisonException(BaseException):
def __str__(self):
return 'Attempting to perform calculations involving junk values.'
@dataclasses.dataclass
class Junk:
represents: str | None = None
def __str__(self):
return '[{}]'.format(self.represents or 'junk')
def __repr__(self):
return self.__str__()
def __format__(self, format):
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