kurtbrose / common_cents

Helpers for inexact multiplication of monetary amounts.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Doc/API ideas

mahmoud opened this issue · comments

  • Illustrative example - show naive version output vs closest_round_division (a la here)
  • Take dictionary input for fractions (e.g., {amount: 1, tax: 0.03})
  • Should numbers be amounts to stay consistent with the currency theme?
  • This should be a list of lists:
    >>> refund([100, 4], [75])
    [75, 3]
  • closest_round_division is a mouthful and seems to be stretching to objectively describe a subjective/qualitative operation. I'd propose something like fair_split(amounts=[], allotments=[])
  • Document the rounding logic around float errors (just that sum([1/6] * 6) != 1 in python, but here it == 1)
  • refund is confusing. Maybe this should be a utility function?
  • split docstring needs to be beefed up. Also "split" is pretty overloaded in python, maybe something like fair_split or even divvy