[issue20752] Difflib should provide the option of overriding the SequenceMatcher
Chris Rose
report at bugs.python.org
Tue Apr 15 17:32:01 CEST 2014
Chris Rose added the comment:
As a historical record, it should be noted that this is driven by an actual use case: I was experimenting with using Bazaar's patience diff implementation, and I saw that in order for them to use a custom sequence matcher, they had to essentially copy-paste and modify the stdlib diff methods in order to inject their own sequence matchers. That struck me as a bad thing, and that's pretty much what led to this.
I welcome a discussion of the API itself; there's definitely a bit of an odd challenge in describing the usage of the matcher variants when both are used (in line_matcher and char_matcher roles).
A possible approach would be to consider matcher factories to take _just_ a junk function, nothing else, and use the SequenceMatcher API's set_seqs method to actually provide the sequences in all cases. This fits the character use case, which reuses the matcher, and the line use case which does not.
----------
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue20752>
_______________________________________
More information about the Python-bugs-list
mailing list