[issue21635] difflib.SequenceMatcher stores matching blocks as tuples, not Match named tuples
Roundup Robot added the comment: New changeset f02a563ad1bf by Raymond Hettinger in branch '2.7': Issue 21635: Fix caching in difflib.SequenceMatcher.get_matching_blocks(). http://hg.python.org/cpython/rev/f02a563ad1bf -- nosy: +python-dev ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21635 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21635] difflib.SequenceMatcher stores matching blocks as tuples, not Match named tuples
Roundup Robot added the comment: New changeset ed73c127421c by Raymond Hettinger in branch '3.4': Issue 21635: Fix caching in difflib.SequenceMatcher.get_matching_blocks(). http://hg.python.org/cpython/rev/ed73c127421c -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21635 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21635] difflib.SequenceMatcher stores matching blocks as tuples, not Match named tuples
Changes by Raymond Hettinger raymond.hettin...@gmail.com: -- resolution: - fixed status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21635 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21635] difflib.SequenceMatcher stores matching blocks as tuples, not Match named tuples
Changes by Raymond Hettinger raymond.hettin...@gmail.com: -- assignee: - rhettinger nosy: +rhettinger ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21635 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21635] difflib.SequenceMatcher stores matching blocks as tuples, not Match named tuples
Raymond Hettinger added the comment: What behavior both looks wrong and gets improved by the change? The incorrect behavior is that matching_blocks is incorrectly cached so that calls to get_matching_blocks() returns an answer without the named tuple (in contravention of the documented behavior): s = SequenceMatcher(None, abxcd, abcd) s.get_matching_blocks() [Match(a=0, b=0, size=2), Match(a=3, b=2, size=2), Match(a=5, b=4, size=0)] s.get_matching_blocks() [(0, 0, 2), (3, 2, 2), (5, 4, 0)] s.get_matching_blocks() [(0, 0, 2), (3, 2, 2), (5, 4, 0)] -- priority: normal - high stage: test needed - needs patch versions: +Python 3.4, Python 3.5 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21635 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21635] difflib.SequenceMatcher stores matching blocks as tuples, not Match named tuples
Terry J. Reedy added the comment: Why do you think this is a bug? What behavior both looks wrong and gets improved by the change? -- nosy: +terry.reedy, tim.peters stage: - test needed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21635 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21635] difflib.SequenceMatcher stores matching blocks as tuples, not Match named tuples
New submission from drevicko: difflib.SequenceMatcher.get_matching_blocks() last lines: non_adjacent.append( (la, lb, 0) ) self.matching_blocks = non_adjacent return map(Match._make, self.matching_blocks) should be something like: non_adjacent.append( (la, lb, 0) ) self.matching_blocks = map(Match._make, non_adjacent) return self.matching_blocks -- components: Library (Lib) messages: 219565 nosy: drevicko priority: normal severity: normal status: open title: difflib.SequenceMatcher stores matching blocks as tuples, not Match named tuples type: behavior versions: Python 2.7 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21635 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com