Dolda2000 GitWeb
/
fulbank.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
88d3c3d
)
Make currency values hashable.
author
Fredrik Tolf
<fredrik@dolda2000.com>
Sun, 6 Jun 2021 00:09:40 +0000
(
02:09
+0200)
committer
Fredrik Tolf
<fredrik@dolda2000.com>
Sun, 6 Jun 2021 00:09:40 +0000
(
02:09
+0200)
fulbank/currency.py
patch
|
blob
|
blame
|
history
diff --git
a/fulbank/currency.py
b/fulbank/currency.py
index
547acb9
..
0c5660c
100644
(file)
--- 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)