carlospalol / money

Python money class with optional CLDR-backed locale-aware formatting and an extensible currency exchange solution.
MIT License
230 stars 34 forks source link

When is division of money by money a valid case? #12

Closed conradstorz closed 9 years ago

conradstorz commented 9 years ago

I understand that multipying money by money is not possible. Why is division implemented? I must be missing something.

carlospalol commented 9 years ago

Hi, to get the ratio between two values, e.g. when calculating a profit margin.

conradstorz commented 9 years ago

Thank you for the quick response and all your work on this class. I want to extend the class into a double entry bookeeping system.

I understand your response above but the result is a ratio not a monetary value and the money type as I read the code returns the division as an instance of money.

carlospalol commented 9 years ago

I'm very glad! let me know if you find any issue in the process.

It really should return a number: https://github.com/carlospalol/money/blob/1.2.1/src/money/tests/mixins.py#L261 https://github.com/carlospalol/money/blob/1.2.1/src-py2/money/tests/mixins.py#L264

conradstorz commented 9 years ago

Have a great day Carlos! Thanks for the link to the test code. I'll shut-up now ;-)