Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Countries for currencies #6

Open
jusce17 opened this issue Dec 12, 2020 · 2 comments
Open

Countries for currencies #6

jusce17 opened this issue Dec 12, 2020 · 2 comments

Comments

@jusce17
Copy link
Contributor

jusce17 commented Dec 12, 2020

Would be nice if you could just write the country and get the currency, like


>>> portugal = Country('PORTUGAL')
>>> portugal.get_currency()
>>> EUR
>>> portugal.get_money_format(13)
>>> '€13'
>>> portugal.get_money_format(13.99)
>>> '€13.99'
>>> portugal.get_money_format('13,2313,33')
>>> '€13,2313,33'
>>>
>>> # Displaying with currency as well
>>>
>>> portugal.get_money_with_currency_format(13)
>>> '€13 EUR'
>>> portugal.get_money_with_currency_format(13.99)
>>> '€13.99 EUR'
>>> portugal.get_money_with_currency_format('13,2313,33')
>>> '€13,2313,33 EUR'
@Alir3z4
Copy link
Owner

Alir3z4 commented Dec 12, 2020

This would be good.
I guess, it can be done via dictionary that has the Country ISO (not the country name as you suggested for instance for United Sates, could be US) as the key and currency for the value and then get the value to lookup the currency.

I'd suggest to work it up as a the Enum which could help to keep it clean.
Soon, I'll add type checking via mypy etc and it would be great to have a full type hints on the code base as well.

Feel free to make a pull request, I'll try to review and give suggestion and get it merged quickly.

@eumiro
Copy link
Contributor

eumiro commented Dec 21, 2020

Another country-specific enhancement (especially for EUR that is used in countries with so many different languages) would be the number format, such as decimal comma/point or thousands separator as space, point, or comma.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants