SequenceMatcher bug ?

eliben eliben at gmail.com
Wed Dec 10 12:14:20 EST 2008


> > My system is Gentoo, which installs python from source.  Maybe gentoo
> > applies patches that the binary releases don't have.
>
> I can't reproduce the problem. I got exactly the same results (0.999...)  
> with all the releases I have at hand, ranging from 3.0 back to 2.1.3, all  
> on Windows.

> Andhttp://try-python.mired.org/says the same thing.
>

What ? This can't be.

1. Go to http://try-python.mired.org/
2. Type
import difflib
3. Type
difflib.SequenceMatcher(None, [4] + [5] * 200, [5] * 200).ratio()

Don't you get 0 as the answer ?

The same with ActivePython on Windows ?

Here's a snapshot from my run on a Linux box:

Python 2.5.2 (r252:60911, Oct 20 2008, 09:11:31)
[GCC 3.4.6 20060404 (Red Hat 3.4.6-10)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import difflib
>>>
>>> difflib.SequenceMatcher(None, [4] + [5] * 200, [5] * 200).ratio()
0.0

Executing exactly the same steps, do you not get 0.0 ?




More information about the Python-list mailing list