[meld] matchers.myers: Use the class form of namedtuple



commit 09e12457e2be65f39b71e8ad445820b7d8fa13dc
Author: Kai Willadsen <kai willadsen gmail com>
Date:   Sat Nov 18 06:19:04 2017 +1000

    matchers.myers: Use the class form of namedtuple
    
    Ideally we'd require 3.6 and use the nice typing.NamedTuple form with
    annotations, etc. but until then this is slightly nicer.

 meld/matchers/myers.py |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)
---
diff --git a/meld/matchers/myers.py b/meld/matchers/myers.py
index 0354883..52e52ef 100644
--- a/meld/matchers/myers.py
+++ b/meld/matchers/myers.py
@@ -54,8 +54,10 @@ def find_common_suffix(a, b):
     return 0
 
 
-DiffChunk = collections.namedtuple('DiffChunk',
-                                   'tag, start_a, end_a, start_b, end_b')
+class DiffChunk(collections.namedtuple(
+        'DiffChunk', 'tag, start_a, end_a, start_b, end_b')):
+
+    __slots__ = ()
 
 
 class MyersSequenceMatcher(difflib.SequenceMatcher):


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]