From 7be2e160233f232c0d559139d1dd2f9efbb5ab0c Mon Sep 17 00:00:00 2001 From: Simon Tatham Date: Fri, 28 Feb 2020 20:13:46 +0000 Subject: [PATCH] numbertheory.py: make the ModP class hashable. That will let me keep them in sets. --- test/numbertheory.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/test/numbertheory.py b/test/numbertheory.py index d485115a..ae3ba324 100644 --- a/test/numbertheory.py +++ b/test/numbertheory.py @@ -177,3 +177,5 @@ class ModP(object): return "0x{:x}".format(self.n) def __repr__(self): return "{}(0x{:x},0x{:x})".format(type(self).__name__, self.p, self.n) + def __hash__(self): + return hash((type(self).__name__, self.p, self.n))