I run a web game that I started in late 2000, back in the Dark Ages before there was a decent python web toolkit. It runs on a then-current version of the OpenACS TCL-based toolkit. (at around 20kloc, porting it to a more modern system wouldn't be worth the effort now.)
Recently, a player suggested that I add a wiki, since my own documentation is chronically out of date and player-run sites tend to suffer bitrot as well. (How many games are you still playing that you started 5 years ago?) So, I backported a modern OpenACS wiki module -- no trivial task; a LOT has changed in OpenACS, and not all for the better -- and was set. Except the module I backported didn't have diff functionality, probably because the various TCL options mostly suck.
Enter TclPython, a tcl module by Jean-Luc Fontaine (who is obviously a far better C hacker than I) that embeds a python interpreter. Sweet! My life just got a lot easier:
package require tclpython set py [python::interp new] # $a and $b are the text of the two revisions -- inject them into the python interpreter $py exec " from difflib import HtmlDiff a = \"\"\"$a\"\"\".split('\\n') b = \"\"\"$b\"\"\".split('\\n') hd = HtmlDiff(wrapcolumn=80) " ns_return 200 text/html [$py eval "hd.make_file(b, a, context=True)"]
The finished result used make_table and included some css to make things pretty, but that's all there is to it fundamentally. Thanks, Mr. Fontaine!