You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi there!
Out of curiosity, was there any decision behind not implementing the __eq__ method inside the Currency class?
In my - maybe naive - understanding, it would make sense to be able to compare Currency objects like so: Currency('USD') == Currency('USD')
which as of now returns False, as the object's pointers are compared, not the values.
My workaround for this is as follows (python 3.10 code, for python < 3.10 the __ne__ method also needs to be implemented)
If for any reason, it doesn't make sense to compare two Currencies with each other, or the implementation on currency.get_money_currency() is too simple, I would really like to undestand the problems with that.
The text was updated successfully, but these errors were encountered:
Hi there!
Out of curiosity, was there any decision behind not implementing the
__eq__
method inside the Currency class?In my - maybe naive - understanding, it would make sense to be able to compare Currency objects like so:
Currency('USD') == Currency('USD')
which as of now returns False, as the object's pointers are compared, not the values.
My workaround for this is as follows (python 3.10 code, for python < 3.10 the
__ne__
method also needs to be implemented)If for any reason, it doesn't make sense to compare two Currencies with each other, or the implementation on
currency.get_money_currency()
is too simple, I would really like to undestand the problems with that.The text was updated successfully, but these errors were encountered: