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

Method real_quick_ratio

Lib/difflib.py:652–662  ·  view source on GitHub ↗

Return an upper bound on ratio() very quickly. This isn't defined beyond that it is an upper bound on .ratio(), and is faster to compute than either .ratio() or .quick_ratio().

(self)

Source from the content-addressed store, hash-verified

650 return _calculate_ratio(matches, len(self.a) + len(self.b))
651
652 def real_quick_ratio(self):
653 """Return an upper bound on ratio() very quickly.
654
655 This isn't defined beyond that it is an upper bound on .ratio(), and
656 is faster to compute than either .ratio() or .quick_ratio().
657 """
658
659 la, lb = len(self.a), len(self.b)
660 # can't have more matches than the number of elements in the
661 # shorter sequence
662 return _calculate_ratio(min(la, lb), la + lb)
663
664 __class_getitem__ = classmethod(GenericAlias)
665

Callers 2

get_close_matchesFunction · 0.95

Calls 1

_calculate_ratioFunction · 0.85

Tested by 1