Skip to content

Currency class redesign

Latest

Choose a tag to compare

@stared stared released this 25 Jan 12:30
· 1 commit to main since this release

Redesigned and refactored currencies so that each currency is an instance of Currency instead of a subclass. It improves both code clarity and allows us to define currencies as follows:

from currex import Currency

USD = Currency("USD")  # one dollar

money = Currency("USD", 100)  # USD(100.00)
money.to("EUR")  # EUR(95.30)

Improved interactive example and readme.