add __hash__ method to Link object to be compatible with the __eq__ method

This commit is contained in:
Shane Evans 2011-01-25 19:23:50 -02:00
parent 32adbea545
commit c5351d2f48
1 changed files with 3 additions and 0 deletions

View File

@ -18,6 +18,9 @@ class Link(object):
def __eq__(self, other):
return self.url == other.url and self.text == other.text
def __hash__(self):
return hash(self.url) ^ hash(self.text)
def __repr__(self):
return '<Link url=%r text=%r >' % (self.url, self.text)