[issue21344] save scores or ratios in difflib get_close_matches

Tim Peters report at bugs.python.org
Fri Apr 25 23:04:50 CEST 2014


Tim Peters added the comment:

Russell, I'm still looking for a sufficiently compelling "use case" here:  something tangible and useful that can be done with the new function that can't be easily done now.

"I plan to write a web API that accepts a word, 'doge' and returns a list of possible suggestions and scores" is not a use case for scores.  It's merely tautological that if you want to return scores then you need a function that does return scores.  A "use case" would more address _why_ the scores are useful.  What would the user of your web API _do_ with the scores?  What's the point?

"users may want to cache (memonize) common queries for super fast look ups" isn't a use case for scores either.  If they wanted to, they could already cache the results of calling `get_close_matches()` - the results of any function can be cached; exposing scores has nothing to do with whether results can be cached.

"the new function will give end-users the opportunity to inspect the scoring algos output" is also more tautological than a use case.  _Why_ would a user want to stare at the scores?  What useful things(s) could they do with them?

I was added to this issue because I wrote these functions to begin with.  At the time, I thought - and asked - about exposing the scores, but nobody (including me) had a _use_ for doing so that justified the added bother of writing & maintaining the additional code and tests and docs.

I'm stilling looking for a use here more substantial than, essentially, just saying "well, without showing the scores we can't show the scores". To me the scores just aren't interesting beyond which words' scores exceed a cutoff, and the ordering of words based on their similarity scores - but `get_close_matches()` already captures those uses.  What other use(s) _do_ you have for the scores?  I'm afraid "just to display them" isn't compelling enough - you're the only one ever to ask for that, and you already know how to do it yourself ;-)

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue21344>
_______________________________________


More information about the Python-bugs-list mailing list