Subtract two Rats, or a Rat and a number (reversed args).
(self, other)
| 103 | return NotImplemented |
| 104 | |
| 105 | def __rsub__(self, other): |
| 106 | """Subtract two Rats, or a Rat and a number (reversed args).""" |
| 107 | if isint(other): |
| 108 | other = Rat(other) |
| 109 | if isRat(other): |
| 110 | return Rat(other.__num*self.__den - self.__num*other.__den, |
| 111 | self.__den*other.__den) |
| 112 | if isnum(other): |
| 113 | return other - float(self) |
| 114 | return NotImplemented |
| 115 | |
| 116 | def __mul__(self, other): |
| 117 | """Multiply two Rats, or a Rat and a number.""" |
no test coverage detected