En Wed, 10 Dec 2008 15:14:20 -0200, eliben <[EMAIL PROTECTED]> escribió:

> 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 ?

Ah, but that isn't the same expression you posted originally:

SequenceMatcher(None, [4] + [10] * 500 + [5], [10] * 500 + [5]).ratio()

Using *that* expression I got near 1.0 always. But leaving out the [5] at the end, it's true, it gives the wrong answer. Old Python 2.1.3 didn't have this problem:

Python 2.1.3 (#35, Apr  8 2002, 17:47:50) [MSC 32 bit (Intel)] on win32
Type "copyright", "credits" or "license" for more information.
import difflib
difflib.SequenceMatcher(None, [4] + [5] * 500, [5] * 500).ratio()
0.99900099900099903
difflib.SequenceMatcher(None, [4] + [5] * 200, [5] * 200).ratio()
0.99750623441396513
difflib.SequenceMatcher(None, [4] + [5] * 100, [5] * 100).ratio()
0.99502487562189057

I've updated the tracker item.

--
Gabriel Genellina

--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to