fix pair object in dict problem

This commit is contained in:
jerryday 2015-10-30 16:38:50 +08:00
parent 4f8ca83661
commit e5e41a4aad

View File

@ -84,6 +84,12 @@ class pair(object):
def __lt__(self, other):
return self.word < other.word
def __eq__(self, other):
return isinstance(other, pair) and self.word == other.word and self.flag == other.flag
def __hash__(self):
return hash(self.word)
def encode(self, arg):
return self.__unicode__().encode(arg)