]> git.mxchange.org Git - quix0rs-apt-p2p.git/commitdiff
Make nodes hashable so they can be used in dictionaries.
authorCameron Dale <camrdale@gmail.com>
Sat, 10 May 2008 04:06:37 +0000 (21:06 -0700)
committerCameron Dale <camrdale@gmail.com>
Sat, 10 May 2008 04:06:37 +0000 (21:06 -0700)
apt_p2p_Khashmir/node.py

index e05e14157a576f9a68245ffb44aceedc40d72369..eff754b318cc5690c41f10470ff678f1a7b28f14 100644 (file)
@@ -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):