From 7c0a9c5c4633e27132daf8d5aa59762933a85654 Mon Sep 17 00:00:00 2001 From: Cameron Dale Date: Fri, 9 May 2008 21:06:37 -0700 Subject: [PATCH] Make nodes hashable so they can be used in dictionaries. --- apt_p2p_Khashmir/node.py | 2 ++ 1 file changed, 2 insertions(+) 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): -- 2.39.5