예제 #1
0
 def subtract(self, other):
     if isinstance(other, ConstInteger):
         return ConstInteger(self.intval - other.intval)
     elif isinstance(other, ConstReal):
         return ConstReal(self.intval - other.doubleval)
     else:
         binary_typeerror(self, other, u"빼기")
예제 #2
0
 def multiply(self, other):
     if isinstance(other, ConstInteger):
         return ConstInteger(self.intval * other.intval)
     elif isinstance(other, ConstReal):
         return ConstReal(self.intval * other.doubleval)
     else:
         binary_typeerror(self, other, u"곱하기")
예제 #3
0
 def greater_than(self, other):
     if isinstance(other, ConstInteger):
         return ConstBoolean(self.doubleval > other.intval)
     elif isinstance(other, ConstReal):
         return ConstBoolean(self.doubleval > other.doubleval)
     else:
         binary_typeerror(self, other, u"대소 비교")
예제 #4
0
 def add(self, other):
     if isinstance(other, ConstInteger):
         return ConstInteger(self.intval + other.intval)
     elif isinstance(other, ConstReal):
         return ConstReal(self.intval + other.doubleval)
     else:
         binary_typeerror(self, other, u"더하기")
예제 #5
0
 def divide(self, other):
     if isinstance(other, ConstInteger):
         return ConstInteger(self.intval / other.intval)
     elif isinstance(other, ConstReal):
         return ConstReal(self.intval / other.doubleval)
     else:
         binary_typeerror(self, other, u"나누기")
예제 #6
0
 def logic_or(self, other):
     binary_typeerror(self, other, u"또는")
예제 #7
0
 def logic_and(self, other):
     binary_typeerror(self, other, u"그리고")
예제 #8
0
 def greater_than(self, other):
     binary_typeerror(self, other, u"대소 비교")
예제 #9
0
 def subtract(self, other):
     binary_typeerror(self, other, u"빼기")
예제 #10
0
 def equal(self, other):
     binary_typeerror(self, other, u"비교")
예제 #11
0
 def logic_or(self, other):
     if isinstance(other, ConstBoolean):
         return ConstBoolean(self.boolval or other.boolval)
     else:
         binary_typeerror(self, other, u"그리고")
예제 #12
0
 def mod(self, other):
     binary_typeerror(self, other, u"나머지")
예제 #13
0
 def divide(self, other):
     binary_typeerror(self, other, u"나누기")
예제 #14
0
 def multiply(self, other):
     binary_typeerror(self, other, u"곱하기")
예제 #15
0
 def add(self, other):
     binary_typeerror(self, other, u"더하기")
예제 #16
0
 def less_than(self, other):
     binary_typeerror(self, other, u"대소 비교")
예제 #17
0
 def mod(self, other):
     if isinstance(other, ConstInteger):
         return ConstInteger(self.intval % other.intval)
     else:
         binary_typeerror(self, other, u"나머지")