Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/commands.py @ 6469:fb502719c75c
python 2.6 compatibility: add __hash__ to classes that have __eq__
author | Paul Moore <p.f.moore@gmail.com> |
---|---|
date | Fri, 04 Apr 2008 22:41:17 +0200 |
parents | af2edc9c5bb9 |
children | 5279848424e7 |
comparison
equal
deleted
inserted
replaced
6468:af2edc9c5bb9 | 6469:fb502719c75c |
---|---|
1044 def __init__(self, line, linenum, colstart, colend): | 1044 def __init__(self, line, linenum, colstart, colend): |
1045 self.line = line | 1045 self.line = line |
1046 self.linenum = linenum | 1046 self.linenum = linenum |
1047 self.colstart = colstart | 1047 self.colstart = colstart |
1048 self.colend = colend | 1048 self.colend = colend |
1049 | |
1050 def __hash__(self): | |
1051 return hash((self.linenum, self.line)) | |
1049 | 1052 |
1050 def __eq__(self, other): | 1053 def __eq__(self, other): |
1051 return self.line == other.line | 1054 return self.line == other.line |
1052 | 1055 |
1053 matches = {} | 1056 matches = {} |