Make currency values hashable.
authorFredrik Tolf <fredrik@dolda2000.com>
Sun, 6 Jun 2021 00:09:40 +0000 (02:09 +0200)
committerFredrik Tolf <fredrik@dolda2000.com>
Sun, 6 Jun 2021 00:09:40 +0000 (02:09 +0200)
fulbank/currency.py

index 547acb9..0c5660c 100644 (file)
@@ -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)