예제 #1
0
 def __rtruediv__(self, other):
     if isinstance(other, (int, float)):
         other = my.numtup(other)
         return Decimales(my.division(other, self.z))
     if isinstance(other, Decimales):
         return Decimales(my.division(other, self.z))
예제 #2
0
 def __eq__(self, other):
     if type(other) != tuple:
         other = my.numtup(other)
     return my.comparacion(self.z, other)
예제 #3
0
 def __rmul__(self, other):
     if isinstance(other, (int, float)):
         other = my.numtup(other)
         return Decimales(my.multiplicacion1(other, self.z))
     if isinstance(other, Decimales):
         return Decimales(my.multiplicacion1(other, self.z))
예제 #4
0
 def __rsub__(self, other):
     if isinstance(other, (int, float)):
         other = my.numtup(other)
         return Decimales(my.resta1(other, self.z))
     if isinstance(other, Decimales):
         return Decimales(my.resta1(other, self.z))
예제 #5
0
 def __init__(self, z):  #parametro son las tuplas, enteros y decimales
     self.z = z
     if (type(z) is int) or (type(z) is float):
         self.z = my.numtup(z)
     else:
         self.z = z
예제 #6
0
 def __add__(self, other):
     if isinstance(other, (int, float)):
         other = my.numtup(other)
         return Decimales(my.suma(self.z, other))
     if isinstance(other, Decimales):
         return Decimales(my.suma(self.z, other))
 def __truediv__(self, other):
     if isinstance(other, Decimales):
         return Decimales(my.division(self.z, other.z))
     elif isinstance(other, (int, float)):
         return Decimales(my.division(self.z, my.numtup(other)))