Re: Diff of Text

2010-06-05 Thread Bryan
GZ wrote: > I should distinguish between modifications and additions. In my above > example, one line is modified/replaced, one line is added and one line > is deleted. There are a total of 3 edits. I am looking for an > alternative python library other than difflib that minimizes this > number (ed

Re: Diff of Text

2010-06-05 Thread GZ
On Jun 5, 8:42 pm, Ben Finney wrote: > GZ writes: > > Let me think of a better way to express what I mean by a "smaller > >diff." After Idiffthe two strings, I will have something like this: > > >   AAA > > - BBB > > + CCC > > + DDD > > - EEE > > > It means the first line does not change, the sec

Re: Diff of Text

2010-06-05 Thread Dave Angel
GZ wrote: 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.

Re: Diff of Text

2010-06-05 Thread Ben Finney
GZ writes: > Let me think of a better way to express what I mean by a "smaller > diff." After I diff the two strings, I will have something like this: > > AAA > - BBB > + CCC > + DDD > - EEE > > It means the first line does not change, the second line is replaced > by the third line, the forth

Re: Diff of Text

2010-06-05 Thread GZ
Hi Lie, On Jun 5, 2:53 am, Lie Ryan wrote: > On 06/05/10 15:43, GZ wrote: > > > > > > > On Jun 4, 8:37 pm, Lie Ryan wrote: > >> On06/05/10 07:51, GZ wrote: > >>> No, rsync does not solve my problem. > > >>> I want a library that does unix 'diff' like function, i.e. compare two > >>> strings line

Re: Diff of Text

2010-06-05 Thread Steven D'Aprano
On Fri, 04 Jun 2010 22:43:48 -0700, GZ wrote: > This still does not do what I want it to do. It only displays the diff > results in a different format. I want a different algorithm to generate > a smaller diff -- in other words less differences Can you give a *short* example, showing the output f

Re: Diff of Text

2010-06-05 Thread Lie Ryan
On 06/05/10 15:43, GZ wrote: > On Jun 4, 8:37 pm, Lie Ryan wrote: >> On06/05/10 07:51, GZ wrote: >>> 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

Re: Diff of Text

2010-06-04 Thread GZ
On Jun 4, 8:37 pm, Lie Ryan wrote: > On06/05/10 07:51, GZ wrote: > > > > > > > Hi Pat, > > > On Jun 4, 2:55 pm, Patrick Maupin wrote: > >> On Jun 3, 9:54 pm, GZ wrote: > > >>> Hi All, > > >>> I am looking for an algorithm that can compare to source code files > >>> line by line and find the mini

Re: Diff of Text

2010-06-04 Thread Lie Ryan
On 06/05/10 07:51, GZ wrote: > Hi Pat, > > On Jun 4, 2:55 pm, Patrick Maupin wrote: >> On Jun 3, 9:54 pm, GZ 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 p

Re: Diff of Text

2010-06-04 Thread GZ
Hi Pat, On Jun 4, 2:55 pm, Patrick Maupin wrote: > On Jun 3, 9:54 pm, GZ 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 desig

Re: Diff of Text

2010-06-04 Thread Patrick Maupin
On Jun 3, 9:54 pm, GZ 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, inste

Diff of Text

2010-06-03 Thread GZ
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 dif