| Store | Cart

Re: [Python-ideas] difflib.SequenceMatcher quick_ratio

From: Serhiy Storchaka <stor...@gmail.com>
Mon, 08 Jun 2015 11:44:38 +0300
On 08.06.15 10:56, floyd wrote:
> I use this python line quite a lot in some projects:>> if difflib.SequenceMatcher.quick_ratio(None, a, b) >= threshold:>> I realized that this is performance-wise not optimal, therefore wrote a> method that will return much faster in a lot of cases by using the> length of "a" and "b" to calculate the upper bound for "threshold":>> if difflib.SequenceMatcher.quick_ratio_ge(None, a, b, threshold):>> I'd say we could include it into the stdlib, but maybe it should only be> a python code recipe?>> I would say this is one of the most frequent use cases for difflib, but> maybe that's just my biased opinion :) . What's yours?>> See http://bugs.python.org/issue24384

If such function will be added, I think it needs better name. E.g. 
difflib.isclose(a, b, threshold).


_______________________________________________
Python-ideas mailing list
Pyth...@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/

Recent Messages in this Thread
floyd Jun 08, 2015 07:56 am
Serhiy Storchaka Jun 08, 2015 08:44 am
Tal Einat Jun 08, 2015 03:15 pm
Matthias Bussonnier Jun 08, 2015 03:39 pm
Andrew Barnert via Python-ideas Jun 08, 2015 01:31 pm
Messages in this thread