Divide two Rats, or a Rat and a number.
(self, other)
| 126 | __rmul__ = __mul__ |
| 127 | |
| 128 | def __truediv__(self, other): |
| 129 | """Divide two Rats, or a Rat and a number.""" |
| 130 | if isRat(other): |
| 131 | return Rat(self.__num*other.__den, self.__den*other.__num) |
| 132 | if isint(other): |
| 133 | return Rat(self.__num, self.__den*other) |
| 134 | if isnum(other): |
| 135 | return float(self) / other |
| 136 | return NotImplemented |
| 137 | |
| 138 | def __rtruediv__(self, other): |
| 139 | """Divide two Rats, or a Rat and a number (reversed args).""" |
no test coverage detected