[issue21344] save scores or ratios in difflib get_close_matches

Tim Peters report at bugs.python.org
Fri Apr 25 05:04:14 CEST 2014


Tim Peters added the comment:

I wonder whether this new function would attract any users, given that the user already has control over the smallest ratio that will be accepted, and over the maximum number of close matches returned.  That's always been sufficient for me.

What useful thing(s) can the user do with the scores?  If there are compelling uses, in _those_ contexts are the `n` and `cutoff` arguments useful too?  Or would it, for example, be more useful to generate all (score, word) pairs and let the user filter them as they wish?  Without a concrete use case, there's no clear answer.

About existing tests for `get_close_matches()`, those are in the function's docstring.  doctest checks them.

About the new tests in the patch, note that comparing lists for equality "should be" done via AssertListEqual, not via AssertEqual.  Don't ask me why, but someone will eventually yell about it ;-)

----------

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


More information about the Python-bugs-list mailing list