On 06/05/10 07:51, GZ wrote: > Hi Pat, > > On Jun 4, 2:55 pm, Patrick Maupin <pmau...@gmail.com> wrote: >> On Jun 3, 9:54 pm, GZ <zyzhu2...@gmail.com> wrote: >> >>> Hi All, >> >>> I am looking for an algorithm that can compare to source code files >>> line by line and find the minimum diff. I have looked at the difflib >>> included in python. The problem is that it is designed to make the >>> diff results easier for humans to read, instead of minimize the size >>> of the output differencial. I would like an algorithm implementation >>> that gives the absolute minimum difference between the two files. >> >>> Can you help me? >> >>> Thanks, >>> gz >> >> There's an "rsync.py" module in pypi -- one would think that would >> have to solve that same problem... >> >> Regards, >> Pat > > No, rsync does not solve my problem. > > I want a library that does unix 'diff' like function, i.e. compare two > strings line by line and output the difference. Python's difflib does > not work perfectly for me, because the resulting differences are > pretty big. I would like an algorithm that generates the smallest > differences.
is n=0 not short enough? pprint.pprint(list(difflib.context_diff(s, t, n=0))) -- http://mail.python.org/mailman/listinfo/python-list