From 619e377ba4263dc5ccdb710ae2e13388e7ed21e9 Mon Sep 17 00:00:00 2001 From: Fredrik Tolf Date: Sun, 6 Jun 2021 02:09:40 +0200 Subject: [PATCH] Make currency values hashable. --- fulbank/currency.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/fulbank/currency.py b/fulbank/currency.py index 547acb9..0c5660c 100644 --- a/fulbank/currency.py +++ b/fulbank/currency.py @@ -143,3 +143,6 @@ class value(object): if self.currency != other.currency: raise ValueError("cannot compare %s with %s" % (self.currency.symbol, other.currency.symbol)) return self.amount >= other.amount + + def __hash__(self): + return hash(self.amount) + hash(self.currency) -- 2.11.0