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

Providing datetime for currency conversion #7

Open cool-RR opened 10 years ago

cool-RR commented 10 years ago

I want to write an app which converts currencies according to the exchange rate on that day. I wish the exchange API would allow a datetime on the conversion call. Also, making it open for arbitrary arguments might be a good idea, because other people might have other needs. (e.g. if someone uses different exchange providers who have different rates, they might want to pass the exchange provider to get the correct rate for it.)

carlospalol commented 10 years ago

You mean Money.to(self, currency, _args, *_kwargs) and passing them to quotation() right? Agreed we need that for more flexibility.

cool-RR commented 10 years ago

Yes. Only caveat with that is that it precludes you from adding arguments to that method in the future. It might be worth it though.

On Sun, Sep 7, 2014 at 12:25 AM, Carlos Palol notifications@github.com wrote:

You mean Money.to(self, currency, _args, *_kwargs) and passing them to quotation() right? Agreed we need that for more flexibility.

— Reply to this email directly or view it on GitHub https://github.com/carlospalol/money/issues/7#issuecomment-54728862.

carlospalol commented 10 years ago

Well, at least new "official" arguments could be added (as kwargs exclusively). In any other scenario, sending new positional arguments would break existing custom backends anyway.

Probably even better to close down positional args altogether, also for custom backends: Money.to(self, currency, **kwargs) and BackendBase.quotation(self, origin, target, **kwargs).

cool-RR commented 10 years ago

I agree that blocking positional arguments is better.

On Sun, Sep 7, 2014 at 2:53 AM, Carlos Palol notifications@github.com wrote:

Well, at least new "official" arguments could be added (as kwargs exclusively). In any other scenario, sending new positional arguments would break existing custom backends anyway.

Probably even better to close down positional args altogether, also for custom backends: Money.to(self, currency, _kwargs) and BackendBase.quotation(self, origin, target, _kwargs).

— Reply to this email directly or view it on GitHub https://github.com/carlospalol/money/issues/7#issuecomment-54732444.