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

Method __rsub__

Lib/test/test_binop.py:105–114  ·  view source on GitHub ↗

Subtract two Rats, or a Rat and a number (reversed args).

(self, other)

Source from the content-addressed store, hash-verified

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."""

Callers 2

test_computationsMethod · 0.45

Calls 4

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

Tested by

no test coverage detected