[issue39891] [difflib] Improve get_close_matches() to better match when casing of words are different

Rémi Lapeyre report at bugs.python.org
Sun Jun 21 13:46:22 EDT 2020


Rémi Lapeyre <remi.lapeyre at henki.fr> added the comment:

I fell like it's a bit weird to have a new function just for ignoring case, will a new function be required for every possible normalization like removing accents. One possible make the API handle those use cases would be to have a keyword-argument for this:


>>> difflib.get_close_matches('apple', ['APPLE'], normalization=str.lower)
['APPLE']

Then it could work with other normalization too without requiring a new function every time:

>>> difflib.get_close_matches('Remi', ['Rémi'], normalization=remove_a ccents)
['Rémi']

----------
components: +Library (Lib)
nosy: +remi.lapeyre
versions: +Python 3.10 -Python 3.9

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue39891>
_______________________________________


More information about the Python-bugs-list mailing list