Imports name this capability’s declared dependencies, which fune builds next to it in your project; each one links to its page.
from .money_amount import Money, assert_same_currency ← from money.amount ^1.0.0 · built alongside by fune
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