[Nick Allen] > After using ndiff from difflib, the function restore > would return the sequence that generated the delta.
It can actually reproduce either sequence from which the delta was generated. But this is really trivial: ndiff was intended to produce diff output for humans to read, and includes the full text of both input sequences in "the diff" it generates. > Unfortunately, restore does not do the same for unified_diff. I do > not see any similar function that is intended for unified_diff. Does > anyone know how to "restore" from a unified diff generated delta? That's in general impossible, since unified diffs generally omit most lines that compared equal to begin with. Unified and context diffs are, in part, compression gimmicks, showing only what changed plus a bit of context. ndiff shows everything, so can restore everything too. -- http://mail.python.org/mailman/listinfo/python-list