[issue45180] possible wrong result for difflib.SequenceMatcher.ratio()

2021-09-15 Thread Nabeel Alzahrani
Nabeel Alzahrani added the comment: Here are the steps that I used to calculate 0.2 for the last example: I used class difflib.HtmlDiff to find the number of changed chars (addedChars, deletedChars, and changedChars) which is 1172 (let us call it delta) The size of both strings a and b in

[issue45180] possible wrong result for difflib.SequenceMatcher.ratio()

2021-09-15 Thread Nabeel Alzahrani
Change by Nabeel Alzahrani : -- resolution: not a bug -> status: closed -> open ___ Python tracker <https://bugs.python.org/issue45180> ___ ___ Pyth

[issue45180] possible wrong result for difflib.SequenceMatcher.ratio()

2021-09-15 Thread Nabeel Alzahrani
Nabeel Alzahrani added the comment: But when I turn off the "autojunk" feature for the following example, I get the wrong ratio of 0.5 instead of the correct ratio of 0.2 with autojunk enabled. a=""" #include #include using namespace std; int main() {

[issue45180] possible wrong result for difflib.SequenceMatcher.ratio()

2021-09-12 Thread Nabeel Alzahrani
New submission from Nabeel Alzahrani : The difflib.SequenceMatcher.ratio() gives 0.3 instead of 1.0 or at least 0.9 for the following two strings a and b: a=""" #include #include using namespace std; int main() { string userWord; unsigned int i;