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)
| 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 |