Raymond Hettinger vze4rx4y at verizon.net
Fri Jul 25 04:39:10 CEST 2003

> 1.  both ndiff and Differ.compare return all the lines including lines that
> are the same in both files, not just the diffs.  is the convention to take
> the output and then filter out lines that contain a space as the first
> character to just get the diffs?  it seems strange to me that the output is
> not just the deltas and a lot of wasted filtering (especially if the file is
> very large) to get the diff you wanted in the first place.  isn't there a
> better way?

The new difflib.py in Py2.3 has two new functions, context_diff()
and unified_diff().  The new functions and an exposed underlying
method strip-away the commonalities leaving only the changes
and context, if desired.

Raymond Hettinger

More information about the Python-list mailing list