Unix diff algorithm in Python anyone?

Dinu C. Gherman gherman at darwin.in-berlin.de
Tue Oct 5 12:27:13 EDT 1999


harri.pasanen at trema.com wrote:
> 
> I made some effort to track down a python module that could be used as
> unix diff.  Currently I'm in fact popen'ing diff itself, but for I'd
> like to have a self-contained utility.
> 
> I'm not comparing big files, so a Python only solution will probably be
> fast enough.
> 
> Failing a ready solution, can someone perhaps point me to a description
> of the algorithm, so I could implement it myself.


Try this:

  http://starship.python.net/crew/gherman/potpurri/align/

and keep in mind that it's pretty rough, unoptimised, 
badly documented and so on... But the examples might
give you an idea if you can use it as a diff in your
own context...

Dinu

-- 
Dinu C. Gherman

................................................................
"An average of more than 15 % of adults in 12 industrialized 
countries are functionally illiterate; in Ireland, the United 
Kingdom and the United States, the rates are over 20 %."

  (The State of the World's Children 1999,
   UNICEF, http://www.unicef.org/sowc99)




More information about the Python-list mailing list