Note that Differ-generated deltas make no claim to be minimal diffs. To the contrary, minimal diffs are often counter-intuitive, because they synch up anywhere possible, sometimes accidental matches 100 pages apart. Restricting synch points to contiguous matches preserves some notion of locality, at the occasional cost of producing a longer diff.
The Differ class has this constructor:
None
):
linejunk: A function that should accept a single string argument, and return true if the string is junk. The default is module-level function IS_LINE_JUNK(), which filters out lines without visible characters, except for at most one pound character ("#").
charjunk: A function that should accept a string of length 1. The default is module-level function IS_CHARACTER_JUNK(), which filters out whitespace characters (a blank or tab; note: bad idea to include newline in this!).
Differ objects are used (deltas generated) via a single method:
Each sequence must contain individual single-line strings ending with newlines. Such sequences can be obtained from the readlines() method of file-like objects. The delta generated also consists of newline-terminated strings, ready to be printed as-is via the writelines() method of a file-like object.
See About this document... for information on suggesting changes.