MCPcopy Index your code
hub / github.com/python/cpython / __mul__

Method __mul__

Lib/test/test_binop.py:116–124  ·  view source on GitHub ↗

Multiply two Rats, or a Rat and a number.

(self, other)

Source from the content-addressed store, hash-verified

114 return NotImplemented
115
116 def __mul__(self, other):
117 """Multiply two Rats, or a Rat and a number."""
118 if isRat(other):
119 return Rat(self.__num*other.__num, self.__den*other.__den)
120 if isint(other):
121 return Rat(self.__num*other, self.__den)
122 if isnum(other):
123 return float(self)*other
124 return NotImplemented
125
126 __rmul__ = __mul__
127

Calls 4

isRatFunction · 0.85
isintFunction · 0.85
isnumFunction · 0.85
RatClass · 0.70

Tested by

no test coverage detected