SequenceMatcher bug ?

Steve Holden steve at holdenweb.com
Wed Dec 10 12:57:13 EST 2008


eliben wrote:
>>> 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 ?
> 
I get 0.0 from everything I've tried it on so far: Cygwin 2.5.1, Windows
2.4.4, Windows 2.5.2, Windows 2.6, Ubuntu 2.5.2, Red Hat 2.4.3,
try-python. All my own machines are Intel architecture, if that makes
any difference. I'm not sure how gentoo would have patched their 2.5.2
when the bug, if 2.6 still contains it.

I find it strange that try-python gives one person a different result
from everyone else. What is this bizarre influence on web sites?

regards
 Steve
-- 
Steve Holden        +1 571 484 6266   +1 800 494 3119
Holden Web LLC              http://www.holdenweb.com/




More information about the Python-list mailing list