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