0.4.0
What's Changed
- feature: Make Overdraft disjoint and independent of Money by @antonagestam in #62
- chore: Test on non-dev Python 3.12 by @antonagestam in #63
- feature: Replace Decimal with int representation by @antonagestam in #65
- feature: Swap truediv and floordiv implementations by @antonagestam in #68
Overdraft can no longer have value=0
In order to make Overdraft
disjoint with the Money
type, and make sure there is a single answer to the question "how is zero money represented?", the Overdraft
type has been updated to give an error for such instantiations. With this same change, Overdraft
was also updated to carry its own value and currency, these are now accessed through the .subunits
and .currency
attributes. The .money
attribute has been removed.
Decimal is replaced with int
This means that Money
and Overdraft
no longer has an internal Decimal value, but instead carries a .subunits
integer attribute. An ad-hoc Decimal can be constructed through the .decimal
property on both types.
Swap __truediv__
and __floordiv__
The implementations of /
and //
have swapped places for Money
, which means SEK(1) / 1
now returns a SubunitFraction
instead of a tuple
of Money
instances.
Full Changelog: 0.3.1...0.4.0