from .money_amount import Money, assert_same_currency def compare_money(a: Money, b: Money) -> int: """-1, 0 or 1, comparing two amounts of the same currency. Refuses mixed currencies: which of GBP 10 and EUR 10 is larger depends on a rate, and a comparison that ignores the currency sorts a list into nonsense. """ assert_same_currency(a, b) return -1 if a.minor < b.minor else 1 if a.minor > b.minor else 0