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

Method _richcmp

Lib/test/test_fractions.py:31–37  ·  view source on GitHub ↗
(self, other, op)

Source from the content-addressed store, hash-verified

29 self.value = value
30
31 def _richcmp(self, other, op):
32 if isinstance(other, numbers.Rational):
33 return op(F.from_float(self.value), other)
34 elif isinstance(other, DummyFloat):
35 return op(self.value, other.value)
36 else:
37 return NotImplemented
38
39 def __eq__(self, other): return self._richcmp(other, operator.eq)
40 def __le__(self, other): return self._richcmp(other, operator.le)

Callers 5

__eq__Method · 0.95
__le__Method · 0.95
__lt__Method · 0.95
__ge__Method · 0.95
__gt__Method · 0.95

Calls 1

from_floatMethod · 0.45

Tested by

no test coverage detected