From: Cameron Dale Date: Sat, 10 May 2008 04:06:37 +0000 (-0700) Subject: Make nodes hashable so they can be used in dictionaries. X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=7c0a9c5c4633e27132daf8d5aa59762933a85654;p=quix0rs-apt-p2p.git Make nodes hashable so they can be used in dictionaries. --- diff --git a/apt_p2p_Khashmir/node.py b/apt_p2p_Khashmir/node.py index e05e141..eff754b 100644 --- a/apt_p2p_Khashmir/node.py +++ b/apt_p2p_Khashmir/node.py @@ -139,6 +139,8 @@ class Node: if type(a) == InstanceType: a = a.num return self.num != a + def __hash__(self): + return hash(self.num) class TestNode(unittest.TestCase):