A bug in difflib module? (find_longest_match)

n00m n00m at narod.ru
Thu May 1 03:35:17 EDT 2008


from random import randint

s1 = ''
s2 = ''

for i in xrange(1000):
    s1 += chr(randint(97,122))
    s2 += chr(randint(97,122))

print s1[:25]
print s2[:25]

import difflib

s = difflib.SequenceMatcher(None, s1, s2)

print s.find_longest_match(0, len(s1), 0, len(s2))



>>> ============== RESTART ====================
>>>
yymgzldocfaafcborxbpqyade
urvwtnkwfmcduybjqmrleflqx
(0, 0, 0)
>>>

I think it's line #314 in difflib "who's to blame" --



More information about the Python-list mailing list